The shell variable $# in Linux,[email protected], the meaning of $0,$1,$2 is explained
Excerpt from: Abs_guide
The meaning of shell variable $#,[email protected],$0,$1,$2 in Linux is explained: Variable Description: $$ The PID of the shell itself (ProcessID) $! PID of the Shell's last running background process $? End code of the last Run command (return value) $- Flag at a glance using the SET command $* All parameter lists. such as "$*" in the Case of "" ", in the form of" $ $ ... $n "output all parameters. [Email protected] All parameter lists. such as "[email protected]" with "" "in the case, with" $ "" $ "... All parameters are output in the form "$n". $# Number of arguments added to the shell $ The name of the shell itself $1~ $n Each parameter value added to the shell. $ $ is the 1th parameter, and the $ = is the 2nd parameter .... |
Example:
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/94/DA/wKioL1kPEuDgc54uAABBfiTMp-4089.png-wh_500x0-wm_ 3-wmp_4-s_2734718160.png "style=" Float:none; "title=" 2.png "alt=" Wkiol1kpeudgc54uaabbfitmp-4089.png-wh_50 "/>
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/94/DA/wKioL1kPEuDCW0RmAAA1UFYw_Us417.png-wh_500x0-wm_ 3-wmp_4-s_2901113361.png "style=" Float:none; "title=" 3q.png "alt=" Wkiol1kpeudcw0rmaaa1ufyw_us417.png-wh_50 "/>
where [email protected] differs from s*:
$* and [email protected] Difference:
The same point: all parameters are referenced.
Different points: only in double quotes. Assuming that three parameters 1, 2, 3 are written when the script is run, "*" is equivalent to "1 2 3" (one parameter is passed), and "@" is equivalent to "1" "2" "3" (three parameters are passed).
Real:
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/94/DB/wKioL1kPE1CSyLlJAAApMRCJ9jA554.png-wh_500x0-wm_ 3-wmp_4-s_2714088596.png "style=" Float:none; "title=" 4.png "alt=" Wkiol1kpe1csylljaaapmrcj9ja554.png-wh_50 "/>
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/94/DB/wKiom1kPE1DTqKtuAAAe2zqA47E963.png-wh_500x0-wm_ 3-wmp_4-s_438569513.png "style=" Float:none; "title=" 7.png "alt=" Wkiom1kpe1dtqktuaaae2zqa47e963.png-wh_50 "/>
This article is from the "Flying Small GUI" blog, make sure to keep this source http://9237101.blog.51cto.com/9227101/1922945
The dollar sign of the shell variable of Linux