{"id":291042,"date":"2024-04-22T05:29:01","date_gmt":"2024-04-21T21:29:01","guid":{"rendered":"https:\/\/lrxjmw.cn\/tslmljzkzhjb.html"},"modified":"2024-04-22T05:29:01","modified_gmt":"2024-04-21T21:29:01","slug":"tslmljzkzhjb","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/tslmljzkzhjb.html","title":{"rendered":"\u63a2\u7d22Linux set\u547d\u4ee4\uff1a\u7cbe\u51c6\u63a7\u5236\u73af\u5883\u53d8\u91cf\u4e0eShell\u8fd0\u884c\u7684\u91cd\u8981\u5229\u5668"},"content":{"rendered":"
Linux<\/a>\u5f00\u6e90\u64cd\u4f5c\u7cfb\u7edf<\/a>\u56e0\u5176\u9ad8\u5ea6\u7075\u6d3b\u7684\u81ea\u5b9a\u4e49\u548c\u914d\u7f6e\u80fd\u529b\u800c\u5e7f\u53d7\u597d\u8bc4\u3002\u5176\u4e2d\uff0cset\u6307\u4ee4\u4ee5\u5176\u4e30\u5bcc\u4e14\u9002\u5e94\u6027\u5f3a\u7684\u7279\u6027\uff0c\u5728\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u53caShell\u8fd0\u884c\u7cbe\u7ec6\u63a7\u5236\u7b49\u9886\u57df\u53d1\u6325\u7740\u91cd\u8981\u4f5c\u7528\uff0c\u56e0\u6b64\u88ab\u5e7f\u6cdb\u91c7\u7eb3\u3002\u672c\u7bc7\u6587\u7ae0\u5c06\u6df1\u5165\u63a2\u8ba8Linuxset\u547d\u4ee4<\/a>\u7684\u591a\u79cd\u5e94\u7528\u65b9\u6cd5\u4ee5\u53ca\u4e0e\u5176\u76f8\u5173\u7684\u77e5\u8bc6\u4f53\u7cfb\u3002<\/p>\n 1.set\u547d\u4ee4\u6982\u8ff0<\/b><\/p>\n Linux\u5185\u5efa\u7684Set\u6307\u4ee4\u662f\u4e00\u9879\u81f3\u5173\u91cd\u8981\u7684Shell\u547d\u4ee4\uff0c\u7528\u4e8e\u8c03\u8282\u548c\u63a7\u5236Shell\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u7684\u5404\u79cd\u53c2\u6570\u8bbe\u7f6e\u3002\u501f\u52a9Set\u6307\u4ee4\uff0c\u7528\u6237\u4e0d\u4ec5\u80fd\u8bbe\u5b9a\u73af\u5883\u53d8\u91cf\uff0c\u8fd8\u80fd\u5f00\u542f\u6216\u5173\u95ed\u7279\u5b9a\u529f\u80fd\uff0c\u4e43\u81f3\u521b\u5efa\u81ea\u5b9a\u4e49\u51fd\u6570\u7b49\u3002\u56e0\u6b64\uff0c\u65e0\u8bba\u5728\u811a\u672c\u7f16\u7a0b\u8fd8\u662f\u7cfb\u7edf\u7ba1\u7406\u9886\u57df\uff0cSet\u6307\u4ee4\u5747\u5177\u6709\u6781\u9ad8\u7684\u5b9e\u7528\u6027\u3002<\/p>\n \u5728Linux\u4e2d\uff0cset\u547d\u4ee4\u901a\u5e38\u7528\u4e8e\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n -\u7cbe\u51c6\u8c03\u6574\u4e0e\u53ca\u65f6\u53d8\u66f4\u73af\u5883\u53d8\u91cf\u914d\u7f6e\uff1a\u8fd0\u7528`set`\u547d\u4ee4\u7ec6\u81f4\u8c03\u6574\u53ca\u7075\u6d3b\u4fee\u6539SHELL\u73af\u5883\u53d8\u91cf\uff0c\u6df1\u5ea6\u4f18\u5316\u5176\u5b9e\u9645\u6548\u80fd\u53ca\u6240\u5c5e\u5b50\u7cfb\u7edf\u6027\u80fd\u3002<\/p>\n -\u5229\u7528Set\u547d\u4ee4\u5bf9Shell\u53c2\u6570\u4e0e\u7279\u6027\u8fdb\u884c\u7cbe\u5bc6\u8c03\u63a7\uff1a\u5de7\u5999\u8fd0\u7528Set\u547d\u4ee4\u8c03\u6574\u5e76\u81ea\u5b9a\u4e49Shell\u7684\u8bf8\u591a\u529f\u80fd\u7279\u6027\uff0c\u5982\u8d4b\u4e88\u811a\u672c\u8fd0\u884c\u8bb8\u53ef\u6743\u7b49\uff0c\u4ee5\u5e94\u5bf9\u610f\u5916\u7684\u8c03\u8bd5\u9700\u6c42\u3002<\/p>\n -\u7ed3\u5408Shell\u51fd\u6570\u7279\u6027\uff1a\u501f\u52a9set\u6307\u4ee4\uff0c\u53ef\u6709\u6548\u5730\u521b\u5efa\u590d\u6742\u529f\u80fd\u7684\u51fd\u6570\uff0c\u5e76\u5c06\u590d\u6742\u7684\u547d\u4ee4\u6216\u7a0b\u5e8f\u7ec4\u5408\u6210\u4fbf\u4e8e\u64cd\u4f5c\u548c\u8c03\u7528\u7684\u5f62\u5f0f\u3002<\/p>\n 2.set\u547d\u4ee4\u7684\u57fa\u672c\u7528\u6cd5<\/b><\/p>\n \u5728Linux\u4e2d\uff0cset\u547d\u4ee4\u7684\u57fa\u672c\u7528\u6cd5\u5982\u4e0b\uff1a<\/p>\n \n \u5176\u4e2d\uff0c\u9009\u9879\u548c\u53c2\u6570\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u7684\u9700\u6c42\u6765\u6307\u5b9a\uff0c\u5e38\u7528\u7684\u9009\u9879\u5305\u62ec\uff1a<\/p>\n --e\u4e3b\u8981\u8d1f\u8d23\u811a\u672c\u6267\u884c\u6d41\u7a0b\u4e2d\u7684\u6545\u969c\u68c0\u6d4b\u53ca\u5f02\u5e38\u7ec8\u6b62\uff0c\u786e\u4fdd\u5728\u53d1\u751f\u9519\u8bef\u65f6\u7acb\u523b\u505c\u6b62\u8fdb\u7a0b\u3002<\/p>\n --u:\u51c6\u786e\u68c0\u6d4b\u672a\u5b9a\u4e49\u53d8\u91cf\uff0c\u786e\u4fdd\u811a\u672c\u5728\u672a\u5b9a\u4e49\u53d8\u91cf\u65f6\u7acb\u5373\u7ec8\u6b62\u3002<\/p>\n ·\"-x\"\u529f\u80fd\uff1a\u53ef\u8be6\u7ec6\u8ddf\u8e2a\u6bcf\u9879\u6307\u4ee4\u53ca\u5176\u76f8\u5e94\u53c2\u6570\u7684\u6267\u884c\u60c5\u51b5\uff0c\u65b9\u4fbf\u8fdb\u884c\u811a\u672c\u8c03\u8bd5\u5de5\u4f5c\u3002<\/p>\n \u901a\u8fc7set\u547d\u4ee4\u53ef\u4ee5\u8bbe\u7f6e\u4e0a\u8ff0\u9009\u9879\uff0c\u4f8b\u5982\uff1a<\/p>\n set-e<\/p>\n set-u<\/p>\n set-x<\/p>\n \u5404\u9879\u9009\u62e9\u53ef\u72ec\u7acb\u6216\u6574\u5408\u8fd0\u7528linux+set\u547d\u4ee4<\/strong>\uff0c\u56e0\u5e94\u5404\u7c7b\u60c5\u5883\u6240\u9700\u3002<\/p>\n 3.\u8bbe\u7f6e\u548c\u4fee\u6539\u73af\u5883\u53d8\u91cf<\/b><\/p>\n \u5728Linux\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u4e0b\uff0c\u73af\u5883\u53d8\u91cf\u5bf9\u7cfb\u7edf\u53ca\u7528\u6237\u7684\u5de5\u4f5c\u73af\u5883\u81f3\u5173\u91cd\u8981\u3002\u5176\u8bbe\u5b9a\u76f4\u63a5\u5f71\u54cd\u5404\u7c7b\u6307\u4ee4\u548c\u7a0b\u5e8f\u7684\u8fd0\u884c\u6548\u679c\u3002\u501f\u52a9set\u547d\u4ee4\uff0c\u53ef\u8fdb\u884c\u73af\u5883\u53d8\u91cf\u53c2\u6570\u7684\u914d\u7f6e\u4e0e\u8c03\u6574\uff0c\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n set\u53d8\u91cf\u540d=\u503c<\/p>\n \u4f8b\u5982\uff0c\u8981\u5c06PATH\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u65b0\u7684\u503c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n \u8def\u5f84\u8bbe\u5b9a\u5e94\u5305\u542b\uff1a\/usr\/local\/bin,\/usr\/bin,\/bin\u3002<\/p>\n \u6210\u529f\u5c06Path\u73af\u5883\u53d8\u91cf\u66f4\u6539\u4e3a\u9884\u5b9a\u8bbe\u5b9a\u7684\/usr\/local\/bin:\/usr\/bin:\/bin\u8def\u5f84\u3002<\/p>\n \u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528set\u547d\u4ee4\u5220\u9664\u5df2\u5b9a\u4e49\u7684\u73af\u5883\u53d8\u91cf\uff0c\u4f8b\u5982\uff1a<\/p>\n set-u\u53d8\u91cf\u540d<\/p>\n \u8fd9\u6837\u5c31\u53ef\u4ee5\u5220\u9664\u6307\u5b9a\u7684\u73af\u5883\u53d8\u91cf\u3002<\/p>\n 4.\u63a7\u5236Shell\u6267\u884c\u9009\u9879<\/b><\/p>\n \u9664\u73af\u5883\u53d8\u91cf\u8bbe\u5b9a\u5916\uff0c\u501f\u52a9Set\u547d\u4ee4\u53ef\u7cbe\u7ec6\u5316\u8c03\u6574Shell\u8fd0\u884c\u73af\u5883\uff0c\u7075\u6d3b\u542f\u7528\u6216\u7981\u7528\u5404\u5f0f\u529f\u80fd\u3002\u4e3e\u4f8b\u6765\u8bf4\uff0c\u901a\u8fc7\u5229\u7528\u8bbe\u7f6e-e\u53c2\u6570linux+set\u547d\u4ee4<\/strong>linux\u670d\u52a1\u5668\u7cfb\u7edf\uff0c\u811a\u672c\u9519\u8bef\u76d1\u63a7\u673a\u5236\u5f97\u4ee5\u5f00\u542f\uff0c\u786e\u4fdd\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u5982\u9047\u9519\u8bef\u7acb\u5373\u505c\u6b62\u6267\u884c\uff0c\u8fd9\u5bf9\u4e8e\u6253\u9020\u9ad8\u6548\u3001\u7a33\u5b9a\u7684Shell\u811a\u672c\u5c24\u4e3a\u91cd\u8981\uff0c\u80fd\u5feb\u901f\u8bc6\u522b\u5e76\u4fee\u590d\u95ee\u9898\uff0c\u63d0\u5347\u811a\u672c\u7684\u7a33\u5b9a\u6027\u4e0e\u53ef\u9760\u6027\u3002<\/p>\n 5.\u5b9a\u4e49Shell\u51fd\u6570<\/b><\/p>\n \u5728LinuxShell\u7f16\u7a0b\u7684\u4e16\u754c\u91cc\uff0c\u51fd\u6570\u53d1\u6325\u4e86\u91cd\u8981\u4f5c\u7528\uff0c\u5b83\u80fd\u5c06\u7e41\u7410\u7684\u64cd\u4f5c\u8fdb\u884c\u6574\u5408\u4e0e\u5c01\u88c5\uff0c\u4f7f\u4e4b\u66f4\u6613\u4e8e\u4f7f\u7528\u3002SET\u547d\u4ee4\u662f\u8bbe\u5b9a\u548c\u5efa\u7acbShell\u51fd\u6570\u7684\u5173\u952e\u5de5\u5177linux\u9a71\u52a8\u4e0b\u8f7d\uff0c\u4ee5\u4e0b\u4e3a\u5176\u6267\u884c\u6d41\u7a0b\uff1a<\/p>\n set-f\u51fd\u6570\u540d(){<\/p>\n \u547d\u4ee4\u5e8f\u5217<\/p>\n }<\/p>\nbash\nset[\u9009\u9879][\u53c2\u6570]\n<\/pre>\n<\/p>\n