{"id":294325,"date":"2024-11-13T12:06:32","date_gmt":"2024-11-13T04:06:32","guid":{"rendered":"https:\/\/lrxjmw.cn\/hjblysdjmlxj.html"},"modified":"2024-11-13T12:06:32","modified_gmt":"2024-11-13T04:06:32","slug":"hjblysdjmlxj","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/hjblysdjmlxj.html","title":{"rendered":"\u73af\u5883\u53d8\u91cf\u4e0e Shell \u7684\u7d27\u5bc6\u8054\u7cfb\u53ca\u5728 Linux \u548c UNIX \u4e2d\u7684\u8bbe\u7f6e\u65b9\u6cd5"},"content":{"rendered":"

\u73af\u5883\u53d8\u91cf\u662f\u548cShell\u7d27\u5bc6\u76f8\u5173\u7684\uff0c\u7528\u6237\u767b\u5165\u7cfb\u7edf\u540e\u5c31\u542f\u52a8\u4e86\u4e00\u4e2aShell\u3002\u5bf9\u4e8eLinux<\/a>\u6765\u8bf4\u901a\u5e38\u662fbash\uff0c\u4f46\u4e5f\u53ef\u4ee5\u91cd\u65b0\u8bbe\u5b9a\u6216\u5207\u6362\u5230\u5176\u5b83\u7684Shell\u3002\u5bf9\u4e8eUNIX\uff0c\u53ef\u80fd\u662fCShelll\u3002\u73af\u5883\u53d8\u91cf\u662f\u901a\u8fc7Shell\u547d\u4ee4<\/a>\u6765\u8bbe\u7f6e\u7684\uff0c\u8bbe\u7f6e\u597d\u7684\u73af\u5883\u53d8\u91cf\u53c8\u53ef\u4ee5\u88ab\u6240\u6709\u5f53\u524d\u7528\u6237\u6240\u8fd0\u884c\u7684\u7a0b\u5e8f\u6240\u4f7f\u7528\u3002\u5bf9\u4e8ebash\u8fd9\u4e2aShell\u7a0b\u5e8f\u6765\u8bf4\uff0c\u53ef\u4ee5\u901a\u8fc7\u53d8\u91cf\u540d\u6765\u8bbf\u95ee\u76f8\u5e94\u7684\u73af\u5883\u53d8\u91cf\uff0c\u901a\u8fc7export\u6765\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u4e0b\u8fb9\u901a\u8fc7\u51e0\u4e2a\u5b9e\u4f8b\u6765\u8bf4\u660e\u3002<\/p>\n

1)etc\/profile:\u6b64\u6587\u4ef6\u4e3a\u7cfb\u7edf\u7684\u6bcf\u4f4d\u7528\u6237\u8bbe\u7f6e\u73af\u5883\u4fe1\u606f,\u5f53\u7528\u6237\u7b2c\u4e00\u6b21\u767b\u9646\u65f6,\u8be5\u6587\u4ef6\u88ab\u6267\u884c.<\/p>\n

\u5e76\u4ece\/etc\/profile.d\u76ee\u5f55\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u641c\u96c6shell\u7684\u8bbe\u7f6e.<\/p>\n

\u6ce8\uff1a\u5728\u8fd9\u513f\u6211\u4eec\u8bbe\u5b9a\u662f\u4e3a\u6240\u6709\u7528\u6237\u53ef\u4f7f\u7528\u7684\u5168\u5c40\u53d8\u91cf\u3002<\/p>\n

2)\/etc\/bashrc:\u4e3a\u6bcf\u4e00\u4e2a\u8fd0\u884cbashshell\u7684\u7528\u6237\u6267\u884c\u6b64\u6587\u4ef6.\u5f53bashshell\u88ab\u6253\u5f00\u65f6,\u8be5\u6587\u4ef6\u88ab\u8bfb\u53d6.<\/p>\n

3)~\/.bash_profile:\u6bcf\u4f4d\u7528\u6237\u90fd\u53ef\u4f7f\u7528\u8be5\u6587\u4ef6\u8f93\u5165\u4e13\u7528\u4e8e\u81ea\u5df1\u4f7f\u7528\u7684shell\u4fe1\u606f,\u5f53\u7528\u6237\u767b\u5165\u65f6,\u8be5\u6587\u4ef6\u4ec5\u4ec5\u6267\u884c\u4e00\u6b21!\u9ed8\u8ba4\u60c5\u51b5\u4e0b,\u4ed6\u8bbe\u7f6e\u4e00\u4e9b\u73af\u5883\u53d8\u91cf,\u6267\u884c\u7528\u6237\u7684.bashrc\u6587\u4ef6.<\/p>\n

\u6ce8\uff1a~\u5728LINUX\u4e0b\u8fb9\u662f\u4ee3\u8868HOME\u8fd9\u4e2a\u53d8\u91cf\u7684\u3002<\/p>\n

\u53e6\u5916\u5728\u4e0d\u540c\u7684LINUX\u64cd\u4f5c\u7cfb\u7edf\u4e0b\uff0c\u8fd9\u4e2a\u6587\u4ef6\u53ef\u80fd\u662f\u4e0d\u540c\u7684\uff0c\u53ef\u80fd\u662f~\/.bash_profile\uff1b~\/.bash_login\u6216~\/.profile\u5176\u4e2d\u7684\u4e00\u79cd\u6216\u51e0\u79cd\uff0c\u5047\u5982\u5b58\u5728\u51e0\u79cd\u7684\u8bdd\uff0c\u8fd9\u4e48\u6267\u884c\u7684\u6b21\u5e8f\u4fbf\u662f\uff1a~\/.bash_profile\u3001~\/.bash_login\u3001~\/.profile\u3002\u4f8b\u5982\u6211\u7528\u7684\u662fUbuntu\uff0c\u6211\u7684\u7528\u6237\u6587\u4ef6\u5939\u4e0b\u9ed8\u8ba4\u7684\u5c31\u53ea\u6709~\/.profile\u6587\u4ef6\u3002<\/p>\n

4)~\/.bashrc:\u8be5\u6587\u4ef6\u5305\u542b\u4e13\u7528\u4e8e\u4f60\u7684bashshell\u7684bash\u4fe1\u606f,\u5f53\u767b\u9646\u65f6\u4ee5\u53ca\u6bcf\u6b21\u6253\u5f00\u65b0\u7684shell\u65f6,\u8be5\u6587\u4ef6\u88ab\u8bfb\u53d6.<\/p>\n

(\u6ce8\uff1a\u8fd9\u4e2a\u6587\u4ef6\u662f.\u5f00\u5934\u7684linux\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u751f\u6548<\/strong>\uff0c\u6240\u4ee5\u5728\u6587\u4ef6\u5939\u4e2d\u88ab\u9690\u85cf\u4e86)<\/p>\n

\u8fd9\u4e48\u6211\u4eec\u600e\u4e48\u6dfb\u52a0\u81ea\u5df1\u5b9a\u4e49\u7684\u73af\u5883\u53d8\u91cf\u5462\uff1f<\/p>\n

\u7528\u8bb0\u4e8b\u672c\u6253\u5f00\u8fd9\u4e2a\u6587\u4ef6\uff0c\u4e4b\u540e\u5728\u4e0a\u9762\u6700\u540e\u5199\u4e0a:<\/p>\n

linux\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u4f5c\u7528_linux\u73af\u5883\u53d8\u91cf\u751f\u6548_linux\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u751f\u6548<\/p>\n

xiaokang=kangkang<\/p>\n

\u4e4b\u540e\u4fdd\u5b58linux\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u751f\u6548<\/strong>\uff0c\u8fd9\u6837\u6bcf\u6b21\u6253\u5f00\u4e00\u4e2a\u65b0\u7684terminal\u7684\u65f6\u4faf\uff0c\u6211\u4eec\u8fd9\u4e2a\u53d8\u91cf\u5c31\u751f\u6548\u4e86\u3002\u8bb0\u4f4f\uff0c\u5047\u5982\u4f60\u65e9\u5df2\u6253\u5f00\u4e00\u4e2aterminal\uff0c\u4e4b\u540e\u4f60\u66f4\u6539\u4e86\u8fd9\u4e2a\u6587\u4ef6\uff0c\u8fd9\u4e48\u5728\u8fd9\u4e2aterminal\u4e0b\u662f\u4e0d\u4f1a\u751f\u6548\u7684\u3002\u901a\u5e38\u60c5\u51b5\u7528\u6237\u6700\u597d\u5728\u8fd9\u513f\u8fdb\u884c\u66f4\u6539\uff0c\u5e76\u4e14\u6709\u65f6\u4faf\u4f1a\u8986\u76d6\u7236\u7ea7\u7684\u53d8\u91cf\uff0c\u4f8b\u5982PATH\u662fROOT\u8bbe\u5b9a\u7684\uff0c\u800c\u4e14\u5047\u5982\u4f60\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e0a\u9762\u5199\u4e86PATH=xx,\u8fd9\u4e48\u5c06\u6765\u6240\u6709\u7684PATH\u90fd\u6210\u4e86xx\u4e86\uff0c\u6240\u4ee5\u6211\u4eec\u5e94\u5f53\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u5199\u4e3a\uff1a<\/p>\n

PATH\uff1d$PATH:xx<\/p>\n

\u8fd9\u6837\u5c31\u628a\u539f\u5148\u7684\u548c\u4f60\u81ea\u5df1\u7684\u4e00\u8d77\u52a0\u4e0a\u4e86\u3002\u5e76\u4e14\u6ce8\u610f\u5728LINUX\u7cfb\u7edf\u4e0b\u7528\uff1a\u5206\u5272\u8868\u793a\u5e76\u5217\uff0c\u800c\u4e0d\u662fwindo\u7684\uff1b<\/p>\n

3\u548c4\u90fd\u662f\u5728\u7528\u6237\u76ee\u5f55\u4e0b\u7684\uff0c\u5979\u4eec\u60df\u4e00\u7684\u4e0d\u540c\u662f:.bash_profile\u53ea\u80fd\u5728\u767b\u9646\u7684\u65f6\u4faf\u542f\u52a8\u4e00\u6b21\u3002\u5728\u6211\u7684Ubuntu\u4e0a\u9762\u8fd9\u4e2a3\u6587\u4ef6\u6216\u8bb8\u6ca1\u6709\u3002<\/p>\n

5)~\/.bash_logout:\u5f53\u6bcf\u6b21\u9000\u51fa\u7cfb\u7edf(\u9000\u51fabashshell)\u65f6,\u6267\u884c\u8be5\u6587\u4ef6.<\/p>\n

\u53e6\u5916,\/etc\/profile\u4e2d\u8bbe\u5b9a\u7684\u53d8\u91cf(\u5168\u5c40)\u7684\u53ef\u4ee5\u4f5c\u7528\u4e8e\u4efb\u4f55\u7528\u6237,\u800c~\/.bashrc\u7b49\u4e2d\u8bbe\u5b9a\u7684\u53d8\u91cf(\u5c40\u90e8)\u53ea\u80fd\u627f\u7ee7\/etc\/profile\u4e2d\u7684\u53d8\u91cf,\u5979\u4eec\u662f\/\"\u5144\u59b9\/\"\u5173\u7cfb.<\/p>\n

~\/.bash_profile\u662f\u4ea4\u4e92\u5f0f\u3001login\u5f62\u5f0f\u6b65\u5165bash\u8fd0\u884c\u7684<\/p>\n

~\/.bashrc\u662f\u4ea4\u4e92\u5f0fnon-login\u5f62\u5f0f\u6b65\u5165bash\u8fd0\u884c\u7684<\/p>\n

\u4e00\u822c\u4e24\u8005\u8bbe\u7f6e\u5927\u81f4\u76f8\u540clinux vi\uff0c\u6240\u4ee5\u4e00\u822c\u540e\u8005\u4f1a\u8c03\u7528\u524d\u8005\u3002<\/p>\n

\u597d\u7684\uff0c\u603b\u7ed3\u4e00\u4e0b\u5979\u4eec\u7684\u6267\u884c\u65b9\u6cd5\uff1a<\/p>\n

linux\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u4f5c\u7528_linux\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u751f\u6548_linux\u73af\u5883\u53d8\u91cf\u751f\u6548<\/p>\n

\u5f53\u4f60\u767b\u5165\u800c\u4e14\u767b\u9646shell\u662fbash\u65f6,bash\u9996\u5148\u6267\u884c\/etc\/profile\u6587\u4ef6\u4e2d\u7684\u547d\u4ee4(\u5047\u5982\u8be5\u6587\u4ef6\u5b58\u5728),\u4e4b\u540e\u5b83\u6b21\u5e8f\u627e\u5bfb~\/.bash_profile,~\/.bash_login\u6216~\/.profile\u6587\u4ef6,\u5e76\u6267\u884c\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u53ef\u8bfb\u6587\u4ef6\u4e2d\u7684\u547d\u4ee4.\u5f53\u767b\u9646bash\u9000\u51fa\u65f6,\u5b83\u5c06\u6267\u884c~\/.bash_logout\u6587\u4ef6\u4e2d\u7684\u547d\u4ee4.<\/p>\n

\u5f53\u542f\u52a8\u4e00\u4e2a\u4ea4\u4e92\u7684bash\u65f6,\u5b83\u5c06\u6267\u884c~\/.bashrc\u6587\u4ef6\u4e2d\u7684\u547d\u4ee4(\u5047\u5982\u8be5\u6587\u4ef6\u5b58\u5728\u800c\u4e14\u53ef\u8bfb).\u5f53\u975e\u4ea4\u4e92\u5730\u542f\u52a8\u4ee5\u8fd0\u884c\u4e00\u4e2ashell\u811a\u672c\u65f6,bash\u5c06\u67e5\u627ebash_env\u73af\u5883\u53d8\u91cf,\u786e\u5b9a\u6267\u884c\u6587\u4ef6\u7684\u540d\u79f0.<\/p>\n

\u7b2c\u4e8c\u7bc7\u8d44\u6599<\/p>\n

--------------------------------------------------------------------------------<\/p>\n

\u5728\u767b\u9646Linux\u65f6\u8981\u6267\u884c\u6587\u4ef6\u7684\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n

\u5728\u521a\u767b\u9646Linux\u65f6\uff0c\u9996\u5148\u542f\u52a8\/etc\/profile\u6587\u4ef6\uff0c\u4e4b\u540e\u518d\u542f\u52a8\u7528\u6237\u76ee\u5f55\u4e0b\u7684~\/.bash_profile\uff1b~\/.bash_login\u6216~\/.profile\u6587\u4ef6\u4e2d\u7684\u5176\u4e2d\u4e00\u4e2a(\u4f9d\u636e\u4e0d\u540c\u7684linux\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e0d\u540c\uff0c\u547d\u540d\u4e0d\u4e00\u6837\uff01\uff01\uff01\uff01\uff01\uff01\uff01\uff01\uff01\uff01\u5728\u6211\u7684Ubuntu\u4e0a\u9762\u53ea\u6709~\/.profile)\uff0c<\/p>\n

\u6267\u884c\u7684\u6b21\u5e8f\u4e3a\uff1a~\/.bash_profile\u3001~\/.bash_login\u3001~\/.profile\u3002<\/p>\n

\u5047\u5982~\/.bash_profile\u6587\u4ef6\u5b58\u5728\u7684\u8bdd\uff0c\u901a\u5e38\u90fd\u4f1a\u6267\u884c~\/.bashrc\u6587\u4ef6\u3002<\/p>\n

\u7531\u4e8e\u5728~\/.bash_profile\u6587\u4ef6\u4e2d\u901a\u5e38\u4f1a\u6709\u4e0b\u8fb9\u7684\u4ee3\u7801\uff1a<\/p>\n

if[-f~\/.bashrc];then<\/p>\n

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

linux\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u751f\u6548_linux\u73af\u5883\u53d8\u91cf\u751f\u6548_linux\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u4f5c\u7528<\/p>\n

fi<\/p>\n

~\/.bashrc\u4e2d\uff0c\u901a\u5e38\u90fd\u4f1a\u6709\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n

if[-f\/etc\/bashrc];then<\/p>\n

.\/bashrc<\/p>\n

fi<\/p>\n

\u6240\u4ee5\uff0c~\/.bashrc\u4f1a\u8c03\u7528\/etc\/bashrc\u6587\u4ef6\u3002\u6700\u540e\uff0c\u5728\u9000\u51fashell\u65f6\uff0c\u5c31\u4f1a\u6267\u884c~\/.bash_logout\u6587\u4ef6\u3002<\/p>\n

\u6267\u884c\u6b21\u5e8f\u4e3a\uff1a\/etc\/profile->(~\/.bash_profile|~\/.bash_login|~\/.profile)->~\/.bashrc->\/etc\/bashrc->~\/.bash_logout<\/p>\n

\u5173\u4e8e\u5404\u4e2a\u6587\u4ef6\u7684\u4f5c\u7528\u57df\uff0c\u5728\u7f51\u4e0a\u627e\u5230\u4e86\u4ee5\u4e0b\u8bf4\u660e\uff1a<\/p>\n

\uff081\uff09\/etc\/profile\uff1a\u6b64\u6587\u4ef6\u4e3a\u7cfb\u7edf\u7684\u6bcf\u4f4d\u7528\u6237\u8bbe\u7f6e\u73af\u5883\u4fe1\u606f,\u5f53\u7528\u6237\u7b2c\u4e00\u6b21\u767b\u9646\u65f6,\u8be5\u6587\u4ef6\u88ab\u6267\u884c.\u5e76\u4ece\/etc\/profile.d\u76ee\u5f55\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u641c\u96c6shell\u7684\u8bbe\u7f6e\u3002<\/p>\n

\uff082\uff09\/etc\/bashrc:\u4e3a\u6bcf\u4e00\u4e2a\u8fd0\u884cbashshell\u7684\u7528\u6237\u6267\u884c\u6b64\u6587\u4ef6.\u5f53bashshell\u88ab\u6253\u5f00\u65f6,\u8be5\u6587\u4ef6\u88ab\u8bfb\u53d6\u3002<\/p>\n

\uff083\uff09~\/.bash_profile:\u6bcf\u4f4d\u7528\u6237\u90fd\u53ef\u4f7f\u7528\u8be5\u6587\u4ef6\u8f93\u5165\u4e13\u7528\u4e8e\u81ea\u5df1\u4f7f\u7528\u7684shell\u4fe1\u606f,\u5f53\u7528\u6237\u767b\u5165\u65f6,\u8be5\u6587\u4ef6\u4ec5\u4ec5\u6267\u884c\u4e00\u6b21!\u9ed8\u8ba4\u60c5\u51b5\u4e0b,\u4ed6\u8bbe\u7f6e\u4e00\u4e9b\u73af\u5883\u53d8\u91cf,\u6267\u884c\u7528\u6237\u7684.bashrc\u6587\u4ef6\u3002<\/p>\n

\uff084\uff09~\/.bashrc:\u8be5\u6587\u4ef6\u5305\u542b\u4e13\u7528\u4e8e\u4f60\u7684bashshell\u7684bash\u4fe1\u606f,\u5f53\u767b\u9646\u65f6\u4ee5\u53ca\u6bcf\u6b21\u6253\u5f00\u65b0\u7684shell\u65f6,\u8be5\u8be5\u6587\u4ef6\u88ab\u8bfb\u53d6\u3002<\/p>\n

\uff085\uff09<\/p>\n

~\/.bash_logout:\u5f53\u6bcf\u6b21\u9000\u51fa\u7cfb\u7edf(\u9000\u51fabashshell)\u65f6,\u6267\u884c\u8be5\u6587\u4ef6.<\/p>\n

\u53e6\u5916,\/etc\/profile\u4e2d\u8bbe\u5b9a\u7684\u53d8\u91cf(\u5168\u5c40)\u7684\u53ef\u4ee5\u4f5c\u7528\u4e8e\u4efb\u4f55\u7528\u6237,\u800c~\/.bashrc\u7b49\u4e2d\u8bbe\u5b9a\u7684\u53d8\u91cf(\u5c40\u90e8)\u53ea\u80fd\u627f\u7ee7<\/p>\n

\/etc\/profile\u4e2d\u7684\u53d8\u91cf,\u5979\u4eec\u662f\"\u5144\u59b9\"\u5173\u7cfb\u3002<\/p>\n

\uff086\uff09~\/.bash_profile\u662f\u4ea4\u4e92\u5f0f\u3001login\u5f62\u5f0f\u6b65\u5165bash\u8fd0\u884c\u7684~\/.bashrc\u662f\u4ea4\u4e92\u5f0fnon-login\u5f62\u5f0f\u6b65\u5165bash\u8fd0\u884c\u7684\u4e00\u822c\u4e24\u8005\u8bbe\u7f6e\u5927\u81f4\u76f8\u540c\uff0c\u6240\u4ee5\u4e00\u822c\u540e\u8005\u4f1a\u8c03\u7528\u524d\u8005\u3002<\/p>\n

\/etc\/profile\u548c\/etc\/environment\u7b49\u5404\u7c7b\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u6587\u4ef6\u7684\u597d\u5904<\/p>\n

\u5148\u5c06exportLANG=zh_CN\u52a0\u5165\/etc\/profile,\u9000\u51fa\u7cfb\u7edf\u91cd\u65b0\u767b\u9646\uff0c\u767b\u9646\u63d0\u793a\u663e\u793a\u4e2d\u6587\u3002<\/p>\n

\u5c06\/etc\/profile\u4e2d\u7684exportLANG=zh_CN\u5220\u6389\uff0c\u5c06LNAG=zh_CN\u52a0\u5165\/etc\/environment\uff0c\u9000\u51fa\u7cfb\u7edf\u91cd\u65b0\u767b\u9646\uff0c\u767b\u9646\u63d0\u793a\u663e\u793a\u82f1\u6587\u3002<\/p>\n

\u7528\u6237\u73af\u5883\u5b8c\u5584\u7684\u8fc7\u7a0b\u4e2d\u603b\u662f\u5148\u6267\u884c\/etc\/profile\u4e4b\u540e\u5728\u8bfb\u53d6\/etc\/environment\u3002\u4e3a\u4f55\u4f1a\u6709\u5982\u4e0a\u6240\u53d9\u7684\u4e0d\u540c\u5462\uff1f<\/p>\n

\u5e94\u5f53\u662f\u5148\u6267\u884c\/etc\/environment\uff0c\u540e\u6267\u884c\/etc\/profile\u3002<\/p>\n

linux\u73af\u5883\u53d8\u91cf\u751f\u6548_linux\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u7684\u4f5c\u7528_linux\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u751f\u6548<\/p>\n

\/etc\/environment\u662f\u8bbe\u7f6e\u6574\u4e2a\u7cfb\u7edf\u7684\u73af\u5883\uff0c\u800c\/etc\/profile\u662f\u8bbe\u7f6e\u6240\u6709\u7528\u6237\u7684\u73af\u5883\uff0c\u540e\u8005\u4e0e\u767b\u5165\u7528\u6237\u65e0\u5173\uff0c\u524d\u8005\u4e0e\u767b\u5165\u7528\u6237\u6709\u5173\u3002<\/p>\n

\u7cfb\u7edf\u5e94\u7528\u7a0b\u5e8f\u7684\u6267\u884c\u4e0e\u7528\u6237\u73af\u5883\u53ef\u4ee5\u662f\u65e0\u5173\u7684\uff0c\u4f46\u4e0e\u7cfb\u7edf\u73af\u5883\u662f\u76f8\u5173\u7684\uff0c\u6240\u4ee5\u5f53\u4f60\u767b\u5165\u65f6\uff0c\u4f60\u770b\u89c1\u7684\u63d0\u793a\u4fe1\u606f\uff0c\u8c61\u65e5\u671f\u3001\u65f6\u95f4\u4fe1\u606f\u7684\u663e\u793a\u683c\u5f0f\u4e0e\u7cfb\u7edf\u73af\u5883\u7684LANG\u662f\u76f8\u5173\u7684\uff0c\u7f3a\u7701LANG=en_US\uff0c\u5047\u82e5\u7cfb\u7edf\u73af\u5883LANG=zh_CNlinux\u547d\u4ee4\u8be6\u89e3\u8bcd\u5178\uff0c\u5219\u63d0\u793a\u4fe1\u606f\u662f\u82f1\u6587\u7684\uff0c\u5426\u5219\u662f\u82f1\u8bed\u7684\u3002<\/p>\n

\u5bf9\u4e8e\u7528\u6237\u7684SHELL\u521d\u59cb\u5316\u800c\u8a00\u662f\u5148\u6267\u884c\/etc\/profile,\u518d\u8bfb\u53d6\u6587\u4ef6\/etc\/environment.\u5bf9\u6574\u4e2a\u7cfb\u7edf\u800c\u8a00\u662f\u5148\u6267\u884c\/etc\/environment\u3002\u8fd9\u6837\u7406\u89e3\u6b63\u786e\u5417\uff1f<\/p>\n

\/etc\/enviroment-->\/etc\/profile-->$HOME\/.profile-->$HOME\/.env(\u5047\u5982\u5b58\u5728)<\/p>\n

\/etc\/profile\u662f\u6240\u6709\u7528\u6237\u7684\u73af\u5883\u53d8\u91cf<\/p>\n

\/etc\/enviroment\u662f\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf<\/p>\n

\u767b\u5f55\u7cfb\u7edf\u65f6shell\u8bfb\u53d6\u7684\u6b21\u5e8f\u5e94\u5f53\u662f<\/p>\n

\/etc\/profile->\/etc\/enviroment-->$HOME\/.profile-->$HOME\/.env<\/p>\n

\u7f18\u7531\u5e94\u5f53\u662fjtw\u6240\u8bf4\u7684\u7528\u6237\u73af\u5883\u548c\u7cfb\u7edf\u73af\u5883\u7684\u533a\u522b\u4e86<\/p>\n

\u5047\u5982\u540c\u4e00\u4e2a\u53d8\u91cf\u5728\u7528\u6237\u73af\u5883(\/etc\/profile)\u548c\u7cfb\u7edf\u73af\u5883(\/etc\/environment)\u6709\u4e0d\u540c\u7684\u503c\u90a3\u5e94\u5f53\u662f\u4ee5\u7528\u6237\u73af\u5883\u4e3a\u51c6\u4e86\u3002---------------------\u672c\u6587\u6765\u81ea\u78a7\u7a7a\u72ec\u4e91\u7684CSDN\u535a\u5ba2\uff0c\u5168\u6587\u5730\u5740\u8bf7\u70b9\u51fb\uff1a<\/p>\n","protected":false},"excerpt":{"rendered":"

\u9ed8\u8ba4\u60c5\u51b5\u4e0b,\u4ed6\u8bbe\u7f6e\u4e00\u4e9b\u73af\u5883\u53d8\u91cf,\u6267\u884c\u7528\u6237\u7684.bashrc\u6587\u4ef6.\u9ed8\u8ba4\u60c5\u51b5\u4e0b,\u4ed6\u8bbe\u7f6e\u4e00\u4e9b\u73af\u5883\u53d8\u91cf,\u6267\u884c\u7528\u6237\u7684.bashrc\u6587\u4ef6\u3002\/etc\/profile\u548c\/etc\/environment\u7b49\u5404\u79cd\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u6587\u4ef6\u7684\u7528\u5904<\/p>\n","protected":false},"author":1,"featured_media":294326,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[4236],"class_list":["post-294325","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-hjblszsepbls"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/294325","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=294325"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/294325\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/294326"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=294325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=294325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=294325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}