Skip to main content

You're reading the free online edition of Effective Shell. If you're finding it useful, please consider picking up the print or Kindle edition from No Starch Press or Amazon - or sharing it with someone who'd enjoy it.

shell-parameter-expansion

VariableDescription
$$This is the process ID of the script itself.
$0The first parameter to the shell, which is typically the path of the shell itself. If this parameter starts with - then the shell is assumed to be a Login Shell.
$-The flags that were set for the shell, such as i for 'interactive'.
$0The first parameter to the shell, which is typically the path of the shell itself.
$1The first parameter
$2The second parameter
${11}The 11th parameter - if the parameter is more than one digit you must surround it with braces
$#The number of parameters
$@The full set of parameters as an array
$*The full set of parameters as a string separated by the first value in the $IFS variable
${@:start:count}A subset of 'count' parameters starting at parameter number 'start'
$?The status code of the most recently called command.

TODO​

Need to update Chapter 19 to link to this.