goelweb.com --> Software --> Unix utilities --> Unix shell --> Shell Built-in Variables
Shell Built-in Variables
- $#
- the number of arguments
- $*
- all arguments to shell
- $@
- similar to $*
$* vs. $@
- $* and $@ expand into the arguments, and are rescanned; blanks in arguments will result in multiple arguments.
- "$*" is a single word composed of all the arguments to the shell file joined together with spaces.
- "$@" is identical to the arguments recevied by the shell file: blanks in arguments are ignored, and the result is a list of words identical to the orginal arguments.
- $-
- options supplied to the shell
- $?
- return values of the last command executed
- $$
- process-id of the shell
- $!
- process-id of the last command started with &
- $HOME
- default argument for cd command
- $IFS
- list of characters that separate words in arguments
- $MAIL
- file that, when changed, triggers "you have mail" message
- $PATH
- list of directories to search for commands
- $PS1
- prompt string, default '$ '
- $PS2
- prompt string for continued command line, default '> '
rishi.goel@alumni.usc.edu