如题所述
1
é¦å å¯å¨ç»ç«¯ã
åå»å±å¹å·¦ä¸è§çUbuntuå¾æ ï¼å¨å¼¹åºççªå£ä¸ç¹å»æç´¢æ ï¼è¾å ¥âterminalâï¼
ç¨ççå»ï¼ç»ç«¯å°±ä¼èµ«ç¶å¨ç®ï¼äºè¯ä¸è¯´ï¼ç´æ¥ç¹å»ï¼
2
ç¶åæå¼ç¯å¢è®¾ç½®æ件ã
Ubuntuçç¯å¢è®¾ç½®æ件为/etc/profileãå®æ¬è´¨ä¸æ¯ä¸ä¸ªShellèæ¬ï¼å ¶ä¸åå¨äºæ¯æ¬¡å¯å¨ç³»ç»æç»ç«¯æ¶é½è¦è¿è¡çå½ä»¤ã
å¨ç»ç«¯ä¸è¾å ¥"sudo gedit /etc/profile"ï¼å车ï¼ç¶åè¾å ¥ç®¡çåå¯ç åå车ï¼å³å¯æå¼ã
3
å å ¥ç¯å¢åé设置è¯å¥ã
Linuxç³»ç»ä¸ï¼è®¾ç½®ç¯å¢åéçè¯å¥æ¯ï¼
export <ç¯å¢åéå>=<åéçå¼>
æ们åªéå¨è¿éæ°å¼ä¸è¡ï¼æç §è¿ä¸ªæ ¼å¼å¡«åå³å¯ã
ä¾å¦ï¼ææ°å»ºä¸ä¸ªå为"mynewenvironmentvar"çç¯å¢åéï¼å®çå¼ä¸ºâå å ¥ä¸ä¸ªæ°çç¯å¢åéï¼ææ¥äºï¼âï¼é£ä¹å°±è¦è¿æ ·åï¼
export mynewenvironmentvar=å å ¥ä¸ä¸ªæ°çç¯å¢åéï¼ææ¥äºï¼
4
让æ们çä¿®æ¹çæã
åå°ç»ç«¯ï¼è¾å ¥"source /etc/profile"ï¼å车ï¼å³å¯è®©æ们çç¯å¢åéçæã
5
æåï¼æ£éªä¸ä¸ææï¼
æ们ç¨echoåæ¾å½ä»¤ï¼ççç¯å¢åéæ没æçæã
åªéè¾å ¥
echo $<ç¯å¢åéå>
å车å³å¯ã
对äºæ设置çåéï¼è¦è¾å ¥ï¼
echo $mynewenvironmentvar
çå°ææäºå§ï¼
6
ä¸è¿ç®åï¼ç¯å¢åéè¿åªæ¯é¨åçæï¼è¿å°±æå³çéå¯ç»ç«¯åï¼åå ç设置å没äºã
ä¸å¿ æ å¿ï¼éå¯ç³»ç»ï¼è®©ç¯å¢åéç设置å®å ¨çæã
END