Builtin variables
$# = The number of arguments supplied to a script.
$* = All the arguments are double quoted. If a script receives two arguments, $* is equivalent to $1 $2.
$@ = What parameters were passed.
$? = Was last command successful. Returns is 0 which means 'yes'
$$ = The process number of the current shell. For shell scripts, this is the process ID under which they are executing.
$! = The process number of the last background command.
Example:
#!/bin/bash
echo "File Name: $0"
echo "First Parameter : $1"
echo "Second Parameter : $2"
echo "Passed Parameters: $@"
echo "Passes Values : $*"
echo "Total no. of Parameters : $#"
Run the above script:
$./temp.sh farhat jahan
File Name: ./temp.sh
First Parameter : farhat
Second Parameter : jahan
Passed Parameters: farhat jahan
Passes Values : farhat jahan
Total no. of Parameters : 2