×÷Õß: OLS3 (ÎÔÁúСÈý)
Ò». ºÎν»·¾³±äÊý
ÔÚËù´¦µÄ»·¾³ÖÐ, ÄÇЩ¹©ÏµÍ³»òÓ¦ÓóÌʽȡÓÃ, ¶ø¹Ì¶¨´æÔÚµÄÒ»ÖÖÌØÊâ±äÊý, ³ÆÖ®.
»·¾³±äÊý¿ÉÓÉϵͳԤ¶¨»òÓÉÄú×ÔÐж¨Òå¼°ÐÞ¸Ä, ÓÖ³ÆΪÕûÌå±äÊý.
Ò²¾ÍÊÇ˵: ²»¹ÜÄãÉí´¦ºÎ·½, ÕâЩ±äÊýµÄÖµ¶¼¸ú×ÅÄãµÄ»·¾³¶ø´æÔÚ.
ÀýÈç: PATH, SHELL, TERMµÈ.....
ÏÔʾ»·¾³±äÊýµÄ·½·¨ÈçÏÂ:
echo $±äÊýÃû³Æ
Èç: echo $PATH
µÃ: /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/kde/bin:/home/ols3/bin
»·¾³±äÊý¿ÉÒÔ´«µÝ¸ø subshell (×Ó shell)
Àý:
PPP1='yes'
export PPP1
bash
echo $PPP1
ÏÔʾ: yes
exit
³£¼ûµÄ»·¾³±äÊý:
SHELL ʹÓÃÄÄÒ»ÖÖ shell
TERM Öն˻úµÄÐÍ̬
MAIL ÓʼþÊÕ¼þλÖÃ
PATH ³ÌʽËÑѰ·¾¶
¶þ. É趨»·¾³±äÊýµÄ·½·¨:
ÔÚ bash »·¾³ÖеÄÉ趨·¨: (ÈôÊÇÆäËü shell µÄ, ÔòÓв»Í¬µÄÉè·¨!!)
1. »·¾³±äÊýÃû³Æ=Öµ (µÈºÅ¶þ±ß²»¿ÉÒÔÓпհ×)
2. export »·¾³±äÊý
Àý:
JACK='me'
export JACK
echo $JACK ¾Í»áÐã³ö me
É趨»·¾³±äÊýµÄ¶¯×÷, ¿É¼ÓÔÚ .bash_profile »ò .bashrc ÖÐ.
Óû½«¾ÉÓÐÖµÑØÓÃ, ¿ÉÀûÓÃË«ÒýºÅ±äÊýÈ¡´úµÄ¹¦ÄÜ:
Èç: PATH="$PATH:/home/ols3/bin;."
Õâʱ, shell »á¶Ô $PATH ×ö±äÊýÈ¡´úµÄ¶¯×÷, Ò²¾ÍÊÇ˵, Èô $PATH µÄÄÚº¬ÊÇ /bin:/sbin
ÔòРPATH µÄÄÚº¬±äΪ /bin:/sbin:/home/ols3:.
É趨ËÑѰ·¾¶
echo $PATH (ÏÈÏÔʾһÏÂÏÖÓеÄËÑѰ·¾¶)
ÏÔʾ: /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/kde/bin:/home/ols3/bin
PATH="$PATH:/home/ols3:." (ÔÚÔÓеÄ·¾¶ÖÐ, ÔÙ¼ÓÉÏ /home/ols3 ¼° . Õâ¶þ¸ö·¾¶)
export PATH
echo $PATH
ÏÔʾ: /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/opt/kde/bin:/home/ols3/bin:/home/ol s3:.