Feed on
Subscription

Setting of Linux environment variable and save a place



? ? 1. HOME of indication environment variable


? ? $ Echo $HOME


? ? / Home/redbooks


? ? 2. Install a new environmental variable Hello


? ? $ Export HELLO="Hello! ? ? $ Export HELLO="Hello!!


? ? $ Echo $HELLO


? ? Hello!


? ? 3. Use Env command shows all environments are variable


? ? $ Env


? ? HOSTNAME=redbooks.safe.org


? ? PVM_RSH=/usr/bin/rsh


? ? SHELL=/bin/bash


? ? TERM=xterm


? ? HISTSIZE=1000


? ? . . .


? ? 4. Use Set commands the Shell that shows all this locality are defined is variable


? ? $ Set


? ? BASH=/bin/bash


? ? BASH_VERSINFO=([0]="2"[1]="05b"[2]="0"[3]="1"[4]="release"[5]="i386-redhat-linux-gnu" )


? ? BASH_VERSION='2.05b.0(1)-release'


? ? COLORS=/etc/DIR_COLORS.xterm


? ? COLUMNS=80


? ? DIRSTACK=()


? ? DISPLAY=:0.0


? ? . . .


? ? 5. Use Unset command will keep clear of the environment is variable


The value that ? ? Set can set variable of a certain environment.The value of cleared environment variable commands with Unset.If did not assign a value,Should change value of a quantity will be set to be NULL.Give typical examples is as follows:


? ? $ Export TEST="Test. . . .. # increases TEST of an environment variable


? ? $ Env | This command of Grep TEST # has an input,Prove environmental variable TEST had existed


? ? TEST=Test. . .


? ? $ Unset $TEST # deletes environmental variable TEST


? ? $ Env | This command of Grep TEST # was not outputted,Prove environmental variable TEST had existed


? ? 6. Use Readonly commands the setting is read-only and variable


If ? ? used Readonly jussive word,Variable can be not revised or kept clear of.Give typical examples is as follows:


? ? $ Export TEST="Test. . . .. # increases TEST of an environment variable


? ? $ Readonly TEST # sets environmental variable TEST for read-only


? ? $ Unset TEST # can discover this variable cannot be deleted


? ? - Bash: Unset: TEST: Cannot Unset: Readonly Variable


? ? $ TEST="New" # can discover this is variable also cannot be revised


? ? - Bash: TEST: Readonly Variable


The setting of variable of ? ? environment is located in / Etc/profile file


If ? ? needs to increase new environmental variable to be able to add subordinate travel


? ? Export Path=$path:/path1:/path2:/pahtN




Related:

    Submit: