{"id":295302,"date":"2024-12-31T04:07:04","date_gmt":"2024-12-30T20:07:04","guid":{"rendered":"https:\/\/lrxjmw.cn\/rhzlzxphjblt.html"},"modified":"2024-12-31T04:07:04","modified_gmt":"2024-12-30T20:07:04","slug":"rhzlzxphjblt","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/rhzlzxphjblt.html","title":{"rendered":"\u5982\u4f55\u5728Linux\u4e2d\u5411PATH\u73af\u5883\u53d8\u91cf\u6dfb\u52a0\u76ee\u5f55\u4ee5\u8fd0\u884c\u81ea\u5b9a\u4e49\u811a\u672c"},"content":{"rendered":"

\u672c\u6587\u8ba8\u8bba\u4e86\u4e00\u4e2a\u91cd\u8981\u7684Linux<\/a>shell\u73af\u5883\u53d8\u91cf\uff0c\u79f0\u4e3aPATH\uff0c\u4ee5\u53ca\u600e\u6837\u5411\u8be5\u53d8\u91cf\u6dfb\u52a0\u76ee\u5f55\u3002<\/p>\n

\u4e00\u822c\uff0c\u60a8\u5728Linux\u7cfb\u7edf\u4e0a\u8fd0\u884c\u7684\u5927\u591a\u6570\u7a0b\u5e8f\u90fd\u53ef\u4ee5\u5b8c\u7f8e\u8fd0\u884c\uff0c\u800c\u4e14\u60a8\u7684shell\u5728\u6267\u884c\u65f6\u4e0d\u4f1a\u51fa\u73b0\u4efb\u4f55\u9519\u8bef\u3002\u5e76\u4e14linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/strong>\uff0c\u6709\u65f6\u60a8\u53ef\u80fd\u5e0c\u671b\u4eceLinux\u7cfb\u7edf\u4e0a\u7684\u975e\u6807\u51c6\u76ee\u5f55\u5feb\u901f\u8fd0\u884c\u81ea\u5b9a\u4e49\u811a\u672c\u6216\u7a0b\u5e8f\u3002<\/p>\n

\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u60a8\u987b\u8981\u5c06\u5b83\u4eec\u7684\u6e90\u76ee\u5f55\u6dfb\u52a0\u5230shell\u7684PATH\u53d8\u91cf\u4e2d\uff0c\u4fbf\u4e8e\u5b83\u6653\u5f97\u5728\u90a3\u91cc\u53ef\u4ee5\u627e\u5230\u5b83\u4eec\u3002<\/p>\n

\u8def\u5f84\u73af\u5883\u53d8\u91cf\u7528\u4e8e\u54ea\u4e9b\uff1f<\/p>\n

\u73af\u5883\u53d8\u91cf\u63a7\u5236shell\u7684\u884c\u4e3a\u3002\u5018\u82e5\u60a8\u4ee5\u524d\u5728Linux\u4e0a\u4f7f\u7528\u8fc7\u547d\u4ee4<\/a>\u884c\uff0c\u7cfb\u7edf\u5c06\u4f9d\u8d56PATH\u53d8\u91cf\u6765\u67e5\u627e\u60a8\u6b63\u5728\u8f93\u5165\u7684\u547d\u4ee4\u7684\u4f4d\u7f6e\u3002<\/p>\n

PATH\u662fLinux\u4e2d\u7684\u4e00\u4e2a\u5916\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u5b83\u544a\u8bc9shell\u5728\u4ec0\u4e48\u76ee\u5f55\u4e2d\u641c\u7d22\u53ef\u6267\u884c\u6587\u4ef6\u4ee5\u54cd\u5e94\u7528\u6237\u6216\u5e94\u7528\u7a0b\u5e8f\u53d1\u51fa\u7684\u547d\u4ee4\u3002\u5b83\u5305\u542b\u4ee5\u9017\u53f7\u5206\u9694\u7684\u76ee\u5f55\u5217\u8868\uff0c\u7528\u4e8e\u67e5\u627e\u60a8\u8f93\u5165\u7684\u547d\u4ee4\u3002<\/p>\n

linux\u73af\u5883\u53d8\u91cf\u8def\u5f84_linux\u8def\u5f84\u53d8\u91cf_linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/p>\n

\u600e\u6837\u5728Linux\u4e0a\u5c06\u76ee\u5f55\u6dfb\u52a0\u5230PATH<\/p>\n

\u8981\u7acb\u523b\u67e5\u770bPATH\u4e2d\u7684\u5185\u5bb9\uff0c\u8bf7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\uff1a<\/p>\n

\n

linuxmi@linuxmi:~\/www.linuxmi.com$ echo $PATH<\/code><\/pre>\n<\/p>\n

\u5982\u60a8\u6240\u89c1linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/strong>\uff0c\u6b64\u53d8\u91cf\u4e2d\u7684\u76ee\u5f55\u7531\u9017\u53f7(:)\u5206\u9694\u3002\u76ee\u524d\u67e5\u770b\u7cfb\u7edf\u7248\u672clinux\uff0cshell\u5728\u4ee5\u4e0b\u76ee\u5f55\u4e2d\u641c\u7d22\u4e8c\u8865\u7801\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n

\u641c\u7d22PATH\u7684\u6b21\u5e8f\u4e5f\u5f88\u91cd\u8981\u3002\u4e3a\u6b64\uff0c\u5047\u82e5\u60a8\u6709\u4e24\u4e2a\u5171\u4eab\u76f8\u540c\u540d\u79f0\u7684\u53ef\u6267\u884c\u6587\u4ef6\u5750\u843d\u4e24\u4e2a\u4e0d\u540c\u7684\u76ee\u5f55\u4e2d\uff0c\u5219shell\u5c06\u8fd0\u884c\u5750\u843dPATH\u4e2d\u7b2c\u4e00\u4e2a\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u3002<\/p>\n

\u4e34\u65f6\u5c06\u76ee\u5f55\u6dfb\u52a0\u5230PATH<\/p>\n

linux\u8def\u5f84\u53d8\u91cf_linux\u73af\u5883\u53d8\u91cf\u8def\u5f84_linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/p>\n

\u5982\u4eca\u5047\u5b9a\u60a8\u65e9\u5df2\u521b\u5efa\u4e86\u4e00\u4e2a\u5750\u843d\/srv\/scripts\u76ee\u5f55\u4e2d\u7684\u81ea\u5b9a\u4e49shell\u811a\u672c\uff0c\u800c\u4e14\u60a8\u5e0c\u671b\u5c06\u6b64\u76ee\u5f55\u6dfb\u52a0\u5230\u60a8\u7684PATH\u53d8\u91cf\u4e2d\u3002\u8fd9\u662f\u4f60\u5e94\u5f53\u505a\u7684\uff1a<\/p>\n

\n

linuxmi@linuxmi:~\/www.linuxmi.com$ export PATH=$PATH:\/srv\/scripts<\/code><\/pre>\n<\/p>\n

\u4e3a\u4e86\u8ba9\u4e8b\u60c5\u66f4\u6e05\u695a\uff0c\u8ba9\u6211\u4eec\u5206\u89e3\u4e00\u4e0b\u8fd9\u4e2a\u53e5\u578b\u3002\u4ee5\u4e0b\u662f\u6bcf\u4f4d\u53c2\u6570\u7684\u6db5\u4e49\uff1a<\/p>\n

\u8ba9\u6211\u4eec\u77a7\u77a7PATH\u5982\u4eca\u7684\u6837\u5b50\uff1a<\/p>\n

\n

linuxmi@linuxmi:~\/www.linuxmi.com$ echo $PATH<\/code><\/pre>\n<\/p>\n

\u6b63\u5982\u60a8\u5728\u524d\u9762\u7684\u8f93\u51fa\u4e2d\u89c1\u5230\u7684\uff0c\u8be5\/srv\/scripts\u76ee\u5f55\u88ab\u6dfb\u52a0\u5230PATH\u53d8\u91cf\u7684\u672b\u5c3e\u3002\u5982\u4eca\uff0c\u60a8\u50a8\u5b58\u5728\/srv\/scripts\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u6267\u884c\uff0c\u800c\u65e0\u9700\u6307\u5b9a\u5b83\u4eec\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/p>\n

linux\u73af\u5883\u53d8\u91cf\u8def\u5f84_linux\u8def\u5f84\u53d8\u91cf_linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/p>\n

\u636e\u6089\uff0c\u5018\u82e5\u60a8\u89c9\u5f97\u60a8\u7684\u76ee\u5f55\u5e94\u5f53\u5728\u5176\u4ed6\u6240\u6709\u5185\u5bb9\u4e4b\u524d\u88ab\u641c\u7d22\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u6dfb\u52a0\u5230$PATH\u3002<\/p>\n

\n

export PATH=\/srv\/scripts:$PATH<\/code><\/pre>\n<\/p>\n

\u8bf7\u52ff\u5fc5\u6ce8\u610f\uff0c\u5047\u82e5\u60a8\u9000\u51fa\u7ec8\u7aef\u6216\u4ece\u7cfb\u7edf\u6ce8\u9500\uff0cPATH\u5c06\u6062\u590d\u800c\u4e14\u4fee\u6539\u5c06\u9057\u5931\uff0c\u7531\u4e8e\u8fd9\u4e9b\u8bbe\u7f6ePATH\u7684\u65b9\u5f0f\u4ec5\u5728\u5f53\u524d\u7ec8\u7aef\u4f1a\u8bdd\u671f\u95f4\u4e34\u65f6\u8bb0\u4f4f\u4fee\u6539\u3002<\/p>\n

\u8981\u4f7f\u5176\u6c38\u4e45\u5316\uff0c\u8bf7\u67e5\u770b\u4ee5\u4e0b\u90e8\u4efd\u3002<\/p>\n

\u5c06\u76ee\u5f55\u6c38\u4e45\u6dfb\u52a0\u5230PATH<\/p>\n

\u8981\u4f7f\u4fee\u6539\u6c38\u4e45\u751f\u6548linux\u9a71\u52a8\u4e0b\u8f7d\uff0c\u60a8\u987b\u8981\u5728shell\u914d\u7f6e\u6587\u4ef6\u4e2d\u5b9a\u4e49PATH\u53d8\u91cf\u3002<\/p>\n

\u9ed8\u8ba4\u7cfb\u7edf\u8303\u56f4\u7684PATH\u503c\u5728\/etc\/profile\u6587\u4ef6\u624b\u6307\u5b9a\u3002\u5c06\u76ee\u5f55\u6dfb\u52a0\u5230\u5355\u4e2a\u7528\u6237\u7684\u8def\u5f84\u7684\u6700\u4f73\u4f4d\u7f6e\u662f\u66f4\u6539\u8be5\u7528\u6237\u7684.bashrc\u6587\u4ef6\u3002<\/p>\n

linux\u8def\u5f84\u53d8\u91cf_linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84_linux\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/p>\n

\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u6587\u4ef6\uff0c\u6eda\u52a8\u5230\u6587\u4ef6\u9876\u90e8\uff0c\u5e76\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n

\n

linuxmi@linuxmi:~\/www.linuxmi.com$ vim ~\/.bashrc<\/code><\/pre>\n<\/p>\n

~\/.bashrc<\/p>\n

\n

export PATH=$PATH:\/srv\/scripts<\/code><\/pre>\n<\/p>\n

source\u6700\u540e\uff0c\u4fdd\u5b58\u6587\u4ef6\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u65b0\u7684PATH\u52a0\u8f7d\u5230\u5f53\u524dshell\u4f1a\u8bdd\u4e2d\uff1a<\/p>\n

\n

linuxmi@linuxmi:~\/www.linuxmi.com$ source ~\/.bashrc<\/code><\/pre>\n<\/p>\n

linux\u8def\u5f84\u53d8\u91cf_linux\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u8def\u5f84_linux\u73af\u5883\u53d8\u91cf\u8def\u5f84<\/p>\n

\u8981\u786e\u8ba4\u76ee\u5f55\u5df2\u6210\u529f\u6dfb\u52a0\uff0c\u8bf7\u952e\u5165\u4ee5\u4e0becho\u547d\u4ee4\u68c0\u6d4b\u8def\u5f84\uff1a<\/p>\n

\n

linuxmi@linuxmi:~\/www.linuxmi.com$ echo $PATH<\/code><\/pre>\n<\/p>\n

\u63a8\u8bba<\/p>\n

\u5728Linux\u4e2d\u5411\u60a8\u7684\u7528\u6237\u6216\u5168\u5c40PATH\u53d8\u91cf\u6dfb\u52a0\u65b0\u76ee\u5f55\u5341\u5206\u7b80\u5355\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u4e86\u89e3\u5230\u6709\u4e24\u79cd\u65b9\u5f0f\u53ef\u4ee5\u505a\u5230\u8fd9\u4e00\u70b9\uff1a\u6682\u65f6\u7684\u548c\u6c38\u4e45\u7684\u3002<\/p>\n

\u5018\u82e5\u60a8\u4ecd\u6709\u7591\u60d1\uff0c\u8bf7\u5728\u8bc4\u8bba\u4e2d\u544a\u8bc9\u6211\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u73af\u5883\u53d8\u91cf\uff0c\u79f0\u4e3aPATH\uff0c\u4ee5\u53ca\u5982\u4f55\u5411\u8be5\u53d8\u91cf\u6dfb\u52a0\u76ee\u5f55\u3002\u7cfb\u7edf\u4e0a\u7684\u975e\u6807\u51c6\u76ee\u5f55\u5feb\u901f\u8fd0\u884c\u81ea\u5b9a\u4e49\u811a\u672c\u6216\u7a0b\u5e8f\u3002\u73b0\u5728\uff0c\u60a8\u5b58\u50a8\u5728\/srv\/scripts\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u6267\u884c\uff0c\u800c\u65e0\u9700\u6307\u5b9a\u5b83\u4eec\u7684\u5b8c\u6574\u8def\u5f84\u3002\u5c06\u76ee\u5f55\u6dfb\u52a0\u5230\u5355\u4e2a\u7528\u6237\u7684\u8def\u5f84\u7684\u6700\u4f73\u4f4d\u7f6e\u662f\u4fee\u6539\u8be5\u7528\u6237\u7684.bashrc\u6587\u4ef6\u3002\u53d8\u91cf\u6dfb\u52a0\u65b0\u76ee\u5f55\u975e\u5e38\u7b80\u5355\u3002<\/p>\n","protected":false},"author":1,"featured_media":295303,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[3114,5302,1006,5304,5303],"class_list":["post-295302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-p-25","tag-tjml","tag-hjbl","tag-xtml","tag-zdyjb"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=295302"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/295302\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/295303"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=295302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=295302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=295302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}