Introduction to Unix

../_images/ksuPoly1.jpg ../_images/UNIX_blocks1.jpeg

5.4. Environment VariablesΒΆ

Linux for Programmers and Users, Section 6.3.10

The Bash shell maintains several environment variables that may be useful in shell script programs. Some of these are discussed in Shell Variables. The list below represents some of the most commonly used environment variables.

Name Meaning
$$ The process ID of this shell.
$! The process ID of the last background command.
$# The number of positional parameters.
$? The exit value of the last command.
$@ An individually quoted list of all the positional parameters.
$HOSTNAME Hostname of the computer
$OLDPWD The previous working directory of the shell.
$OSTYPE The operating system of the computer.
$PPID The process ID of the shell’s parent.
$PS1 The setting for the command prompt. See PS1.
$PWD The current working directory of the shell.
$UID The user ID of the user.