BASH PARAMETERS

Bash expands positional and special parameters on the command line before executing the command. This is most commonly done within a script file. The term positional parameters refer to the list of arguments types after the command on the command line. Special parameters are listed below. An example of positional parameters is:
 
   paste numbers names
 
numbers is stored into positional parameter $1, and
names is stored into positional parameter $2.
 

Positional Parameters

A positional parameter is a parameter denoted by one or more digits, other than the single digit 0. Positional parameters are assigned from the shell's arguments when it is invoked. Braces are needed to expand positional parameters greater than nine. Example: $9 expands parameter 9, and ${10} expands parameter 10.

Special Parameters

$* Expands all positional parameters (starting from 1). Within a shell script, $* expands all arguments on the command line. When $* occurs within double quotes, the expansion is treated as a single word.
$@ Expands all positional parameters (starting from 1). Within a shell script, $@ expands all arguments on the command line. When $@ occurs within double quotes, the expansion is treated as a collection of individual quoted strings.
$# Expands to the number of positional parameters (arguments) on the command line.
$? Expands to the exit status code of the most recently executed foreground program.
$$ Expands to the process ID (PID) of the shell
$! Expands to the process ID of the most recently executed background program.
$0 Expands to the name of the shell script