Transfer
1. location parameters
The parameters provided by the system are called location parameters. The value of the location parameter can be obtained using $ N. N is a number. If it is 1, it is $1. It is similar to the number in C language.
In Linux, the input command string is segmented and each segment is labeled with a label starting from 0. No. 0thProgramName, which indicates the parameter passed to the program from 1. For example, $0 indicates the program name.
$1 indicates the first parameter passed to the program, and so on.
2. Internal Parameters
In the above process, $0 is an internal variable, which is mandatory, while $1 is dispensable. There are several internal variables that are the same as $0.
$ # ---- Total number of parameters passed to the program
$? ---- PreviousCodeOr the shell program exits in the shell. If it Exits normally, 0 is returned. Otherwise, it is not 0.
$ * ---- A string consisting of all parameters passed to the program.
$ N ---- indicates the first parameter, $1 indicates the first parameter, and $2 indicates the second parameter...
$0 ---- name of the current program
$ @ ---- Save all parameters in the form of "parameter 1" "parameter 2 "...
$ ---- PID of the Program (process ID)
$! ---- PID of the previous command