The following lists the common methods of $
$n represents the arguments passed to the script, representing the first one, and the second one ...
$# represents the number of arguments passed to the script
$0 represents the name of the script.
$? indicates the exit status of the last command, success is 0, otherwise 1
$$ indicates the ID number of the current program process
$! represents the ID number of the last program process
[email protected] all parameters passed to the script
illustrate:
[email protected]:~$ VI 1. SH
#!usr/bin/bash-x
#!usr/bin/bash-x
echo "$$"
#!usr/bin/bash-x
Echo "$", "$";
echo "$#"
Echo "$"
test-e xyy.py
echo "$?"
echo "$$"
echo "[email protected]"
Plus permissions:
[email protected]:~$ chmod 777 1.sh
The corresponding output is as follows:
[email protected]:~$ bash 1.sh a b
a,b
2
1.sh
1
4436
a b< /p>
Usage of $ in Linux shell