Tuesday, September 26, 2017

Bash Special Parameters

Special parameters are set by the shell to store information about aspects of its current state, such as the number of arguments and the exit code of the last command. Special parameters can only be referenced and cannot have it's value assigned.
Specia parameters are: $*, $@, $#, $$, $!, $?, $0, $-, $_
ParameterDefinition
$*List of arguments (as a string)
$@List of arguments (as an array)
$#Number of positional parameters
$$PID of the current shell
$!PID of the last command executed in the background
$?Exit code of the last-executed command
$0Path to the currently running script
$-Current shell option flags
$_Gives the last argument to the previous command

No comments: