|
Linux environment, the user through the shell, the system will enable users early environment variables, such as the system of public resource path: path, include, bin and other directories. Shell mode, execute export, view the user environment variables, echo $ key query an environment variable.
Set environment variables, there are two ways, into a temporary setting, and permanently set.
a. Temporary settings (with immediate effect)
shell mode execution:
export PATH = "$ PATH: / opt / au1200_rm / build_tools / bin"
b. Permanent settings
# End of the line an additional export ...
vi / etc / profile
export PATH = "$ PATH: / opt / au1200_rm / build_tools / bin"
vi /root/.bashrc
export PATH = "$ PATH: / opt / au1200_rm / build_tools / bin"
The above can be seen in several ways, set the environment variable in the process is the same. shell mode, direct execution of the script, the environment variables into memory so that with immediate effect, the other shell environment can not use this environment variable (isolation). Permanently set, append the / etc / profile, /root/.bashrc end of the file export key = "value" of these two files when a user opens a shell client, automatically, which takes precedence over /root/.bashrc / etc / profile. Do the following test:
vi / etc / profile
export TEST = "test1"
vi /root/.bashrc
export TEST = "$ TEST: test2"
Enter the export, the results in the new shell mode:
declare -x TEST = "test1: test2"
Therefore, / etc / profile script prior to the beginning of /root/.bashrc make, which can cover the former. |
|
|
|