linux environment variable (temporary + permanent)

Temporary settings:

1, the direct use export command: 

#export the PATH = $ the PATH: / Home / xyz / Tesseract / bintesseract executable directory 

#export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: // home / xyz / Tesseract / lib path of its dependencies lept 

#export TESSDATA_PREFIX = / home / xyz / Tesseract / share its dependence on the path where the training data file 

to see if the good has been set, view the available commands export: 

# export or #echo $ pATH

  Permanently set:

1, a profile change file: 

Modify / etc / profile (are valid for all users) 

#vi / etc / profile 

inside added: 

Export the PATH = "$ the PATH: / Home / XYZ / Tesseract / bin" 

2, modified. bashrc file: 

modify ~ / .bashrc file. (Both, ls -all, each user effectively separate user directory) 

CD ~ 

VI .bashrc 

inside added: 

Export the PATH = "$ the PATH: / opt / au1200_rm / build_tools / bin" 

permanent setting process generally need to log off the system to take effect, log out after heavy landing, you can test the echo command:

  Set, Cancel:

1, view the current user's local shell set with the set command all variables 

    #set 2, unset variables with unset 
    #unset $ TESSDATA_PREFIX

  

"/ Bin", "/ sbin ", "/ usr / bin", "/ usr / sbin", "/ usr / local / bin" and other path is already in the system environment variable, and if the executable files in these the standard position, the terminal command line, type the file name and parameters of the software executable file (if required parameter), press enter. 

  If not in the standard location, in front of the file names need to add the full path. But in every case to run too much trouble, a "once and for all" approach is to join this path environment variable. Command "PATH = $ PATH: Path" can join this path environment variable, but quit the command line becomes ineffective. To permanent, we need to add this line to the environment variable file. There are two files Optional: ".bash_profile", "/ etc / profile" in the "/ etc / profile" and the user's home directory is valid for all users of the system, ".bash_profile" in the user's home directory only this the user is valid. 

  "PATH = $ PATH: Path 1: Path 2: ...: Path n", meaning that the executable file path includes a path pre-set, as well as all paths from the "Path 1" to "route n",. When a user enters a string of characters and press Enter after, shell in turn find the corresponding executable file path in these systems and to the implementation of the core. That "$ PATH" represents the path of the original set is still valid, be careful not to miss. There may be some software other than "PATH" environment variable type needs to be added, but the method and the same, and also need to pay attention to "$." 

  Note that, with the DOS / Window different, UNIX-based system environment variable path names separated by colons, semicolons not. In addition, the software is installed, the more the environment variable to add more, in order to avoid confusion, it is recommended that all statements are added to the end of the file, add the order of installation of the software.
 

  

Format is as follows (): 

  # Name software - version number 

  PATH = $ PATH: Path 1: Path 2: ...: n path 

  other environmental variables = $ other environmental variables: ... 

  in the "profile" and ".bash_profile" "#" is a comment symbol, in addition to visually separate written here has no effect outside. 

  Set up, log out and log back in, set to become effective. If you do not log out, executed directly in the shell these statements, but also to take effect, but the scope is limited to the implementation of the shell of these statements. 

  After the relevant environmental variables to take effect, you do not have to go to the old executable directory software

  

Guess you like

Origin www.cnblogs.com/lcxiao/p/11361052.html