Reference parameters |
Describe |
0,1,2. |
Positional parameters. Start with the parameter 0. The parameter 0 references the name of the Startup bash program, and if the function runs in the shell script, the name of the shell script is referenced. Strings that are caused by single or double quotation marks are passed as a parameter, and the quotation marks are removed when passed. In the case of double quotes, shell variables such as $home are extended before the function is called. For parameters that contain embedded white space or other characters, you need to use either single or double quotation marks for delivery. |
* |
Displays all parameters passed to the script in a single string, which can be more than 9 parameters, unlike positional variables. |
@ |
Starting with parameter 1, all parameters passed to the script are displayed. If you extend in double quotes, each parameter becomes a word, so "[email protected]" is equivalent to "$" "$". This form is used if the parameter has the potential to contain embedded whitespace.
|
# |
Number of parameters (not including parameter 0) |
$ |
The current process ID number for the script to run |
! |
ID number of the last process that the script runs |
? |
Displays the exit status of the last command, 0 means no error, and any other value indicates an error |
- |
Displays the current options used by the shell, the same as the SET command function. |
Parameter references in the shell