$# is the number of arguments passed to the script $0 is the name of the script itself $1 is the first argument passed to the shell script $2 is passed to the shell script The second parameter $@ is a list of all parameters passed to the script $* is a single string that shows all the parameters passed to the script, unlike the position variable, The parameter can exceed 9 $$ is the current process ID number of the script run $? is to display the exit status of the last command, 0 indicates no errors, others indicate an error
Difference: @@ 和 * The same point: all refer to all parameters are different points: only in double quotes reflected. Suppose that three parameters were written when the script was run (stored in 1, 2, 3), then "*" is equivalent to "1 2 3" (passing a parameter), and "@" is equivalent to "1", "2", "3" (passed three parameters)
Example One
# #dels. Sh
echo "number:$#" echo "
scname:$0"
echo "--" echo "Second:$2" echo "
argume:$@"
echo "show Parm list:$* "
echo" show process id:$$ "
echo" show Precomm stat: $? "
Execution results
[@jihite]$ sh del.sh 1 2 3 number:3 scname:del.sh first:1 second:2 argume:1 2 3 show Parm List:1 2 3 show process ID: 21057 Show Precomm stat:0
Source:
Http://www.cnblogs.com/kaituorensheng/p/4002697.html