As I always have a tendency to forget the special variables used in shell scripts, I am going to document down the variables here.
The variables are applicable for most of the shells (sh, bash, ksh, etc) if not all.
Name Description $0 The name of the script currently being executed $1 - $9 Positional parameters or arguments passed to the shell script. Each parameter corresponds to the position of the argument passed to the script; $1 is the 1st argument, $2 is the 2nd argument. $# The number of positional arguments passed to the shell script $? Exit status of the last executed command $$ Process ID of the shell being executed $! Process ID of the last command run in the background $- The set of options which were supplied to the shell at invocation $* Expands to the positional parameters, starting from one $@ Expands to the positional parameters, starting from one Note: Both $* and $@ will behave the same except when double quoting is used. $* takes the entire list as one argument with spaces in between and the $@ takes the entire list and separates it into different arguments.