Parameter parsing the $

EX:
#!/bin/sh
echo "number:$#"
echo "scname:$0"
echo "first :$1"
echo "second:$2"
echo "argume:$@"
echo "show parm list:$*"
echo "show process id:$$"
echo "show precomm stat: $?"
 
 
./test.sh aa bb
RESULT:
number:2
scname:./variable
first:aa
second:bb
argume:aa bb
show parm list:aa bb
show process id:24544
show precomm stat:0
 
 
$ # Is the number of parameters passed to the script
$ 0 is the name of the script itself
$ 1 is the first argument passed to the shell script
$ 2 is the second parameter passed to the shell script
$ @ Is a list of all the parameters passed to the script
$ * Is a single string that is displayed all the different parameters passed to the script, and location variables, parameters can be more than 9
$$ script is running the current process ID number
$? Exit status of the last command is displayed, and 0 indicates no error, the other indicates an error code reader is used to exit the shell vinegar

Guess you like

Origin www.cnblogs.com/Leo-Wanta/p/11207840.html