Process status variables 1, $ get the Current shell Process number (PID) 2, $! Run PID3, $? Obtain the return value for executing the previous command (0 is successful, non-zero is failed, this is very common) 4. $ _ the last parameter cat & gt; test $. shecho '$ =' $ echo '$! = '$! Echo '$? = '$? Echo '$ @ =' $ @ echo '$ _ =' $ _ # output the following shtest
Process status variable
1. $ get the current shell process ID (PID)
2. $! PID used to execute the previous command
3. $? Obtain the return value for executing the previous command (0 indicates success, and non-zero indicates failure, which is very common)
4. $ _ the last parameter of the command or script previously executed
Cat> test $. shecho '$ =' $ echo '$! = '$! Echo '$? = '$? Echo '$ @ =' $ @ echo '$ _ =' $ _ # output the following sh test \ $. sh 1 2 3 $ = 2556 $! = $? = 0 $ @ = 1 2 3
$ * And $ @
$ * Treat all parameters as a single string, equivalent to "$1 $2 $3"
$ @ Treat each parameter as a single string and retain any blank characters in the command line
set-- 'I am'jane leefori in$*; doecho$i; done;Iamjaneleefori in$@; doecho$i; done;Iamjaneleefori in"$@"; doecho$i; done;I amjaneleefori in"$*"; doecho$i; done;I am jane lee