Linux PATHÇéÐαäÁ¿Ïê½â¼°ÉèÖÃÒªÁì
Linux PATHÇéÐαäÁ¿Ïê½â¼°ÉèÖÃÒªÁì
ÔÚLinuxϵͳÖУ¬PATHÇéÐαäÁ¿ÊÇÒ»¸öºÜÊÇÖ÷ÒªµÄÇéÐαäÁ¿£¬ËüÓÃÓÚÖ¸¶¨ÏµÍ³ÔÚÄÄЩĿ¼ÖвéÕÒ¿ÉÖ´ÐÐÎļþ¡£Í¨¹ýÉèÖÃPATHÇéÐαäÁ¿£¬¿ÉÒÔÀû±ãµØÖ´ÐÐϵͳÖеÄÏÂÁîºÍ³ÌÐò¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ÏêϸڹÊÍPATHÇéÐαäÁ¿µÄ×÷ÓúÍÉèÖÃÒªÁ죬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
ʲôÊÇPATHÇéÐαäÁ¿£¿
PATHÇéÐαäÁ¿ÊÇÒ»¸ö°üÀ¨Ò»ÏµÁÐĿ¼·¾¶µÄ×Ö·û´®£¬ÓÃðºÅ£¨:£©ÍÑÀë¡£µ±ÄãÔÚÖÕ¶ËÖÐÊäÈëÒ»¸öÏÂÁîʱ£¬ÏµÍ³»áÔÚPATHÇéÐαäÁ¿Ö¸¶¨µÄĿ¼Öа´Ë³Ðò²éÕÒ¶ÔÓ¦µÄ¿ÉÖ´ÐÐÎļþ£¬²¢Ö´ÐÐÕÒµ½µÄµÚÒ»¸öÎļþ¡£ÈôÊÇÏÂÁîµÄ¿ÉÖ´ÐÐÎļþ²»ÔÚPATHÇéÐαäÁ¿Ö¸¶¨µÄĿ¼ÖУ¬ÏµÍ³½«ÎÞ·¨ÕÒµ½¸ÃÏÂÁî¡£
ÔõÑùÉó²éÄ¿½ñPATHÇéÐαäÁ¿µÄÉèÖã¿
ÔÚÖÕ¶ËÖУ¬¿ÉÒÔʹÓÃechoÏÂÁî´òÓ¡Ä¿½ñϵͳµÄPATHÇéÐαäÁ¿ÉèÖá£ÊäÈëÒÔÏÂÏÂÁ
echo $PATH
µÇ¼ºó¸´ÖÆ
ϵͳ»áÊä³öÄ¿½ñµÄPATHÇéÐαäÁ¿ÉèÖã¬ÆäÖÐÒÔðºÅÍÑÀëµÄ¸÷Ŀ¼·¾¶¼´ÊÇϵͳËÑË÷¿ÉÖ´ÐÐÎļþµÄ˳Ðò¡£
ÔõÑùÐÞ¸ÄPATHÇéÐαäÁ¿µÄÉèÖã¿
ÒªÐÞ¸ÄPATHÇéÐαäÁ¿µÄÉèÖ㬿ÉÒÔͨ¹ýÔÚÓû§µÄÉèÖÃÎļþ£¨Èç.bashrc¡¢.bash_profile£©ÖÐÌí¼Ó·¾¶£¬»òͨ¹ýexportÏÂÁîÊÖ¶¯Ìí¼Ó·¾¶¡£ÏÂÃæÊÇÏêϸµÄʾÀý£º
ÔÚÖÕ¶ËÖÐʹÓÃexportÏÂÁîÌí¼Óеķ¾¶µ½PATHÇéÐαäÁ¿£º
export PATH=$PATH:/path/to/your/directory
µÇ¼ºó¸´ÖÆ
Õâ»á½«/path/to/your/directoryÌí¼Óµ½PATHÇéÐαäÁ¿µÄĩβ¡£
ÈôÊÇÏëÒª½«Â·¾¶Ìí¼Óµ½PATHÇéÐαäÁ¿µÄ¿ªÍ·£¬¿ÉÒÔʹÓÃÈçÏÂÏÂÁ
export PATH=/path/to/your/directory:$PATH
µÇ¼ºó¸´ÖÆ
ÕâÑùϵͳ½«Ê×ÏÈÔÚ/path/to/your/directoryĿ¼ÖвéÕÒ¿ÉÖ´ÐÐÎļþ¡£
³ýÁËͨ¹ýexportÏÂÁîÊÖ¶¯Ìí¼Ó·¾¶Í⣬»¹¿ÉÒÔ±à¼Óû§µÄÉèÖÃÎļþ£¬ÔÚÎļþĩβÌí¼ÓÀàËƵÄÐУº
PATH=$PATH:/path/to/your/directory export PATH
µÇ¼ºó¸´ÖÆ
±à¼Íê³Éºó£¬¼ÇµÃÖ´ÐÐsourceÏÂÁîÒÔʹÉèÖÃÎļþÉúЧ£º
source ~/.bashrc
µÇ¼ºó¸´ÖÆ
ÒÔÉϲÙ×÷½«ÔÚÖÕ¶ËÖÐÓÀÊÀÐÞ¸ÄPATHÇéÐαäÁ¿µÄÉèÖá£
×ܽá
ͨ¹ý±¾ÎĵÄÏÈÈÝ£¬ÐÅÍи÷È˶ÔLinuxϵͳÖеÄPATHÇéÐαäÁ¿ÓÐÁ˸üÉîÈëµÄÏàʶ¡£Í¨¹ýºÏÀíÉèÖÃPATHÇéÐαäÁ¿£¬¿ÉÒÔÀû±ãµØÖ´ÐÐϵͳÖеÄÏÂÁîºÍ³ÌÐò£¬Ìá¸ßÊÂÇéЧÂÊ¡£Ï£Íû±¾ÎĶԸ÷ÈËÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇLinux PATHÇéÐαäÁ¿Ïê½â¼°ÉèÖÃÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡