Special variables:
$#the number of arguments passed to the script;
$*displays all parameters passed to the script in a single string. Unlike positional variables, this option can have more than 9 parameters;
$$the current process ID number for the script to run;
$!Process ID Number of the last process running in the background;
[email protected]same as $*, but quoted when used, and returns each parameter in quotation marks;
$-Displays the current options used by the shell, same as the set command function;
$?Displays the exit status of the last command. 0 means there is no error, and any other value indicates an error;
Positional variables:
Variable Name: $, $, $, $,$4, $,$6,$7,$8,$9
Description:
$: Represents the script name.
$1,$2,..., $9: $ $ represents the first parameter passed to the script, and the second argument passed to the script,..., $9 represents the Nineth parameter passed to the script.
If you want to pass information to a shell script, you can use the positional parameters to complete this function, the number of parameters related to the script, which can be arbitrarily many, but only the first 9 can be accessed, using the shift command can change the limit; The parameter starts at the first and ends at Nineth; A $ sign is added before each access parameter, and the first parameter is 0, which indicates that the actual script name is reserved and is available regardless of whether the script has parameters.
Special variables in the shell