Home  >  Article  >  System Tutorial  >  There are three types of variable classifications of environment variables in Shell.

There are three types of variable classifications of environment variables in Shell.

WBOY
WBOYforward
2024-03-21 08:00:55482browse

Unixshell variable classification

There are three types of variables in the Shell: internal variables, environment variables, and user variables.

Internal variables: provided by the system, no need to define linux modification of user environment variablesGetting started with linux, cannot be changed

Environment variables: The system provides linux to modify user environment variables. You don’t need to define Linux software. You can change it. You can use export to convert user variables into environment variables.

User variables: user-defined, can be changed

(1) Internal variables (system variables, environment variables, parameter variables, predefined variables)

Internal variables are a special type of variables provided by Linux. These variables are used to make decisions in the program. The value of such variables cannot be changed within the shell program.

Description of representation

$n$1 represents the first parameter, $2 represents the second parameter...

$#Number of command line parameters

$0The name of the current program

修改环境变量linux_linux修改用户环境变量_linux修改环境变量的值

$?The return code of the previous command or function

$*Save all parameters in the "Parameter 1 Parameter 2..." mode

$@Save all parameters in the form of "Parameter 1" "Parameter 2"...

$$The (process ID number) PID of this program

(2)Environment variables

Linux environment (also known as shell environment) consists of many variables and the values ​​of these variables. The appearance of the environment is determined by the values ​​of these variables and variables. Such variables are environment variables.

修改环境变量linux_linux修改环境变量的值_linux修改用户环境变量

includes two parts, one is set by the system, mainly including: HOME, LOGNAME, MAIL, PATH, PS1, PWD, SHELL, TERM

Second, if the user sets it on the command line, use the export command, and the value will be lost when the user logs out

(3)User variables (private variables, local variables)

Set by yourself in the command line.

For more database and Linux technical content, please search "Chongqing Sizhuang"

linux修改环境变量的值_linux修改用户环境变量_修改环境变量linux

The above is the detailed content of There are three types of variable classifications of environment variables in Shell.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:itcool.net. If there is any infringement, please contact admin@php.cn delete