The dollar sign ($) is often used in Linux. The following is what they represent:
$0 shell command itself (including the full path)
$1 to $9 indicates the shell Parameters
$ # Number of parameters passed to the script
$ * Display all parameters passed to the script with a single string
$ ID of the script run
$! ID of the last process running in the background
$ @ Is the same as $.
$-Display the current options used by shell.
$? Displays the execution status of the last command. 0 indicates no error.
For example:
Test. ShCode
#! /Bin/bashecho "\ $0 is:" $0 echo "\ $1 is:" $1 echo "\ $2 is:" $2 Echo "\ $ * is: "$ * echo" \ $ @ is: "$ @ echo" \ $ # is: "$ # echo" \ $! Is: "$! Echo "\ $ is:" $ echo "\ $? Is: "$?
Execution output:
$ Sudo. /test. sh P1 P2 $0 is :. /test. sh $1 is: P1 $2 is: P2 $ * is: P1 P2 $ @ is: P1 P2 $ # Is: 2 $! Is: $ is: 3469 $? Is: 0
Reference: http://blog.csdn.net/lovingprince/article/details/6332636