Common usage:
export PATH=$PATH:/home/zhaodw
Better to modify environment variables, but only valid in this login
Note: (Combined with shell variables)
1 = No $ sign is added to the previous PATH variable
2 Use additional paths: add
Function description: Set or display environment variables.
Syntax: export [-fnp][variable name]=[variable setting value]
Additional Note: When executing a program in a shell, the shell provides a set of environment variables. export can add, modify or delete environment variables for subsequent execution of programs. The effectiveness of export is only for this login operation.
parameter:
-f represents the function name in [variable name].
-n Delete the specified variable. The variables are not actually deleted, but they are not output to the execution environment of subsequent instructions.
-p List all the environment variables assigned to the program by the shell
The export setting environment variable is temporary and is only valid in this login. You can modify the following file to make the command valid for a long time.
1. Modify the profile file:
#vi /etc/profile
Added in:
export PATH="$PATH:/opt/au1200_rm/build_tools/bin"
This is shared by everyone on our machine. It is recommended not to modify this, but only modify the root path.
That is, the second method
2. Modify the .bashrc or .bash_profile file under the root path of this id:
# vi /home/zhaodw/.bash_profile
Included in:
export PATH="$PATH:/opt/au1200_rm/build_tools/bin"
Notice:
1. When executing the script, it is run in a subshell environment. After the script is executed, the subshell automatically exits;
2. Only when the system environment variables in a shell will be copied into the subshell (variables defined with export);
3. The system environment variable in a shell is only valid for the shell or its child shell. The variable disappears when the shell ends (it cannot be returned to the parent shell).
4. Variables that do not use export are only valid for this shell, and are also invalid for subshells.