Special parameters are Parameters treated specially. metacharacter ??
These parameters may only be referenced; assignment to them is not allowed.
Positional parameters Expansion
Positional parameter expansion
- Star (*)
- At (@)
- Hash (#)
? expands to the status of the most recently executed foreground pipeline.
0 # All good
- expands to the current option flags. See Bash - Shell Option (Shopt)
$ expands to the process ID of the shell. In a () subshell, it expands to the process ID of the current shell, not the subshell.
Exclamation mark (!)
! expands to the process ID of the most recently executed background (asynchronous) command.
0 Expands to the name of the shell or shell script.
_ At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list.
Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file currently being checked.