One
$n: Gets The nth argument of the current shell script, n=1..9, when n is 0, represents the file name of the script, if n is greater than 9, enclosed in curly braces like${10}.
$*: Gets all parameters of the current shell and treats all command-line arguments as a single string.
[Email protected]: All parameters of this program "$" "$" "$" "...", this is the best way to pass parameters to other programs, so TA retains any whitespace embedded in each parameter.
$#: Gets the total number of parameters in the current shell command line.
$_: Represents the last parameter of the previous command
eg
Cat Test.sh#!/bin/bashecho $_
SH test.sh 1 2 3 4 5
/bin/sh
$!: PID representing the last executed background command
eg
? Agent git: (master)? Nohup./falcon-agent- c cfg.json &> var/app.log &[1] 76901? Agent git: (master)? Ps-p $! PID TTY time CMD76901 ttys000 0:00.01./falcon-agent-c Cfg.json? Agent git: (master)? echo $!76901? Agent git: (master)? Ps-p $! PID TTY time CMD76901 ttys000 0:00.02./falcon-agent-c Cfg.json? Agent git: (master)? Echo $!76901
? Agent git: (master)? Nohup Sh./test.sh &
[2] 79469
Appending output to Nohup.out
? Agent git: (master)? Echo $!
79469
Two
Reference: http://www.111cn.net/sys/linux/79750.htm
026_ about special variables in the shell $ $n $* [email protected] $! $?