Unix shell Variable Classification
There are three variables in shell: internal variables, environment variables, and user variables.
Internal variables: provided by the system. They do not need to be defined and cannot be modified.
Environment variable: provided by the system. It can be modified without definition. You can use export to convert user variables into environment variables.
User variable: user defined, which can be modified
(1) internal variables (system variables, environment variables, parameter variables, pre-defined variables)
Internal variables are a special type of variables provided by Linux.ProgramTo make a judgment. In a shell program, the values of such variables cannot be modified.
Description
$ N $1 indicates the first parameter, and $2 indicates the second parameter...
$ # Number of command line parameters
$0 name of the current program
$? The return code of the previous command or function.
$ * Save all parameters in the form of "parameter 1 parameter 2 ..."
$ @ Save all parameters in the form of "parameter 1" "parameter 2 "...
$ PID of the Program (process ID)
(2) Environment Variables
A Linux environment (also known as a shell environment) is composed of many variables and the values of these variables. The values of these variables and variables determine the appearance of the environment. These variables are environment variables.
It consists of two parts: one is set by the system, including home, LOGNAME, mail, path, PS1, PWD, Shell, term
Second, the Export command is set in the command line, but the user's logout value will be lost.
(3) User variables (private variables, local variables)
In the command line.