$ file name and path
$1,$2 parameter 1, parameter 2
$# The number of arguments passed to the script or function
current shell process ID
judge execution succeeded or not 0 for success
[email protected] Pass all parameters of a script or function
$* Pass all parameters of a script or function
${}
Note: [Email protected] and the $* 's All Pass all parameters of a script or function. When enclosed by double quotation marks , the two have the following differences
[email protected] shell]# cat 007.sh
#!/bin/bash
For var in " [email protected] "
Do
echo "$var"
Done
[[Email protected] shell]# sh 007.sh feng cx Xiao
Feng
Cx
Xiao
[email protected] shell]# cat 007.sh
#!/bin/bash
For Var in "$*"
Do
echo "$var"
Done
[[Email protected] shell]# sh 007.sh feng cx Xiao
Feng Cx Xiao
$var and ${var} Differences
such as: When you want to display variable values with random characters
Echo $var _ AA $var will use the _aa later as part of the variable.
Echo ${var}_aa ${var} does not use the following _aa as part of a variable
This article is from the "Feng" blog, make sure to keep this source http://fengxiaoli.blog.51cto.com/12104465/1952185
Shell Special position variable ($0,$1$2,$*,$#,$$,$?,[email protected], ${})