Shell built in variables

Some useful shell variables for shell programming:

$# gives number of command line arguments

$* gives all command line arguments

$@ gives all command line arguments

$- option supplied to shell, useful to test if the shell is interactive (interactive shells contain i)

$$ gives the process-id of the shell

$! gives the process-id of the last process that was started in the background

Leave a Reply