Introduction to AIX environment variables and the use of [plain] environment variables are the variables set in the operating system environment, applicable to user processes throughout the system; environment variables can be set in commands, however, when you log out, these settings will be lost. if you want to apply them again, it is best. profile definition; ring...
Introduction to AIX environment variables and the use of [plain] environment variables are the variables set in the operating system environment, applicable to user processes throughout the system; environment variables can be set in commands, however, when you log out, these settings will be lost. if you want to apply them again, it is best. the use of environment variables is the same as that of local variables, but before use, you must use the export command to export. Www.2cto.com 1. set two statements for environment variables in the same row, and use semicolons to separate VARIABLE-NAME = value; export VARIABLE-NAME can also be written in different lines: VARIABLE-NAME = value export VARIABLE-NAME 2. view environment variables: env 3. clear environment VARIABLE: unset VARIABLE-NAME 4. embedded shell variable 4.1 CDPATH: this variable retains some directory information, separated by the colon. If this variable is set, shell will first find the value saved in this variable when a directory is stored in cd; if the directory for cd switching is saved in this variable, switch to this directory. Www.2cto.com 4.2 EXINIT: this variable saves the initialization options in the vi editor, such as displaying the row number and adding the tab key to the 10th spaces. the command is: EXINIT = 'set nu tab = 10 '; export EXINIT 4.3 HOME: HOME directory, which is usually used to locate the last 2nd columns of the passwd file. it specifies that the user logs on to his/her Directory and stores the user's file information under this directory. When "cd $ HOME" is input, it is switched to the user's directory. Www.2cto.com 4.4 IFS: used as the default domain separator specified by shell. the default domain separator can be space, new line, or tab key. 4.5 LOGNAME: save login name 4.6 MAIL: save the mailbox path name, default:/var/spool/mail/ . 4.7 MAILCHECK: by default, the new email is not checked 60 s. you can set it to another time, such as 180 s. 4.8 MAILPATH: stores the email path of multiple users. setting this variable will overwrite the MAIL value. 4.9 PATH: stores the directory order for command or script search. sorting these directories is important because it is related to the query time of command execution; generally, we first query data from the root directory of the user to other directories. 4.10 PS1: Basic prompt. the super user is #. you can set it as needed. 4.11 PS2: the affiliated prompt. the default value is ">". it is used to execute multiple-line commands or a command that exceeds one line. 4.12 SHELL: save the default shell, which is usually set in/etc/passwd. you can modify the shell and use other shells. Www.2cto.com 4.13 TERMINFO: the location where the terminal initialization variables are stored in the terminal configuration file. 4.14 TERM: the storage terminal type. The set TERM is the control sequence type of the application to learn the terminal's response to the screen and keyboard, for example, vt100, vt200, etc. 4.15 TZ: save the time zone value, only the system administrator can change this setting. 5. other environment variables include some other reserved environment variables that will be used by other systems or command line applications, such as: 5.1 EDITOR: set EDITOR, which is commonly used. 5.2 PWD: save the current working path name. 5.3 PAGER: the command for saving screen paging, such as pg and more 5.4 MANPATH: The Directory for saving man files on the system, separated. 5.5 LPDEST or PRINTER: save the default PRINTER name. The PRINTER name is specified for the print job. 6. set command in $ HOME. in the profile file, when setting environment variables, in addition to export, there is also the set-a command to indicate that all variables are exported directly; but do not set them in/etc/profile, in your $ HOME. profile. The following is an example of a shell script in father. in the sh script, the child. sh script, and modify father. the variable value in sh is as follows: pg father. sh # father script echo "This is the father" SMART_PHONE = "iPhone 5" echo "I have the phone: $ SMART_PHONE" # call the child script sh child. sh echo "The phone father owned is: $ SMART_PHONE" pg child. sh # child echo "called from father .. I am the child "echo" phone is :$ {SMART_PHONE:-unknow} "SMART_PHONE =" Meizu MX2 "echo" changin G SMART_PHONE to: $ SMART_PHONE "execution script: sh father. sh This is the father I have the phone: iPhone 5 called from father .. I am the child phone is: unknow-> ① do not know The changing SMART_PHONE to: Meizu MX2 the phone father owned is: iPhone 5, we do not know the variables in the parent process in the child process, because we did not export the variable values in the parent process. Www.2cto.com modify father. sh script: pg father. sh # father script echo "This is the father" SMART_PHONE = "iPhone 5" echo "I have the phone: $ SMART_PHONE" # call the child script export SMART_PHONE-> ② sh child. sh echo "The phone father owned is: $ SMART_PHONE" now runs The modified script. The child process knows The variable passed by The parent process: sh father. sh This is the father I have the phone: iPhone 5 called from father .. I am the child phone is: iPhone 5-> ① after export, I met changing SMART_PHONE to: Meizu MX2 The phone father owned is: iPhone 5 -- the end --
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service