Description of special positional parameter variables commonly used by shell
Original: http://m.blog.itpub.net/15498/viewspace-2151142/
$ $ Gets the file name of the currently executing shell script, including the script path if the execution script contains the path
The $n gets the nth parameter value of the currently executing shell script, n=1..9, which represents the file name of the script when n is 0, or if n is greater than 9, enclosed in curly braces, such as ${10}, and the arguments are separated by spaces
$# gets the total number of parameters that are followed by the currently executing shell script
$* gets the arguments for all parameters of the current shell script, without quotation marks and [email protected], if you add double quotes to $*, such as "$*", all parameters are treated as a single string, equivalent to "$ $ $"
[Email protected] Gets the arguments for all parameters of the current shell script, without quotes and $*: If you add double quotes to $@, such as "[email protected]", all parameters are treated as separate strings, equivalent to "$" "$" $ 3 "" ... ". This is the best way to pass multiple arguments to other programs because it preserves any whitespace embedded in each parameter. When "[email protected]" and "$*" are both double quotes, there is a difference between the two, without double quotation marks when there is no difference.
$ Gets the return value of the last instruction executed by the current shell script
Go Description of special positional parameter variables commonly used by shell