Special Shell Variables
The Bourne shell has a number of special “automatic” variables that it maintains for informational purposes. These variables provide information such as the process ID of the shell, the exit status of the last command, and so on. This section provides a list of these special variables. For additional variables supported by specific Bourne shell variants such as BASH and ZSH, see the
zshparam manual pages, respectively.
Process ID of shell
Process ID of shell’s parent process.
Exit status of last command.
Name of last command.
Process ID of last process run in the background using ampersand (&) operator. This is commonly used in conjunction with the
A colon-delimited list of locations where trusted executables are installed. Any executable in one of these locations can be executed without specifying a complete path.
Field and record parsing
Input Field Separators (uses are explained in “Variable Expansion and Field Separators”)
The user’s home directory.
The user’s ID.
The user’s (short) login name.
Number of arguments passed to the shell. This variable is described further in “Handling Flags and Arguments.”
Complete list of arguments passed to the shell, separated by spaces.. This variable is described further in “Handling Flags and Arguments.”
Complete list of arguments passed to the shell, separated by the first character of the
A list of all shell flags currently enabled.
The current working directory. Equivalent to executing the