{"id":6513,"date":"2020-01-21T11:37:27","date_gmt":"2020-01-21T03:37:27","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6513"},"modified":"2020-01-21T16:45:59","modified_gmt":"2020-01-21T08:45:59","slug":"set","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/set","title":{"rendered":"set\u547d\u4ee4 – \u8bbe\u7f6eshell"},"content":{"rendered":"\n

set\u547d\u4ee4\u80fd\u8bbe\u7f6e\u6240\u4f7f\u7528shell\u7684\u6267\u884c\u65b9\u5f0f\uff0c\u53ef\u4f9d\u7167\u4e0d\u540c\u7684\u9700\u6c42\u6765\u505a\u8bbe\u7f6e\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>set [\u53c2\u6570] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong> <\/p>\n\n\n\n

-a <\/td>\u6807\u793a\u5df2\u4fee\u6539\u7684\u53d8\u91cf\uff0c\u4ee5\u4f9b\u8f93\u51fa\u81f3\u73af\u5883\u53d8\u91cf<\/td><\/tr>
-b<\/td>\u4f7f\u88ab\u4e2d\u6b62\u7684\u540e\u53f0\u7a0b\u5e8f\u7acb\u523b\u56de\u62a5\u6267\u884c\u72b6\u6001<\/td><\/tr>
-C<\/td>\u8f6c\u5411\u6240\u4ea7\u751f\u7684\u6587\u4ef6\u65e0\u6cd5\u8986\u76d6\u5df2\u5b58\u5728\u7684\u6587\u4ef6<\/td><\/tr>
-d <\/td>Shell\u9884\u8bbe\u4f1a\u7528\u6742\u51d1\u8868\u8bb0\u5fc6\u4f7f\u7528\u8fc7\u7684\u6307\u4ee4\uff0c\u4ee5\u52a0\u901f\u6307\u4ee4\u7684\u6267\u884c\u3002\u4f7f\u7528-d\u53c2\u6570\u53ef\u53d6\u6d88<\/td><\/tr>
-e<\/td>\u82e5\u6307\u4ee4\u4f20\u56de\u503c\u4e0d\u7b49\u4e8e0\uff0c\u5219\u7acb\u5373\u9000\u51fashell<\/td><\/tr>
-f<\/td>\u53d6\u6d88\u4f7f\u7528\u901a\u914d\u7b26<\/td><\/tr>
-h <\/td>\u81ea\u52a8\u8bb0\u5f55\u51fd\u6570\u7684\u6240\u5728\u4f4d\u7f6e<\/td><\/tr>
-k<\/td>\u6307\u4ee4\u6240\u7ed9\u7684\u53c2\u6570\u90fd\u4f1a\u88ab\u89c6\u4e3a\u6b64\u6307\u4ee4\u7684\u73af\u5883\u53d8\u91cf<\/td><\/tr>
-l<\/td>\u8bb0\u5f55for\u5faa\u73af\u7684\u53d8\u91cf\u540d\u79f0<\/td><\/tr>
-m <\/td>\u4f7f\u7528\u76d1\u89c6\u6a21\u5f0f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong> <\/p>\n\n\n\n

\u4f7f\u7528declare\u547d\u4ee4\u5b9a\u4e49\u4e00\u4e2a\u65b0\u7684\u73af\u5883\u53d8\u91cf”mylove”\uff0c\u5e76\u4e14\u5c06\u5176\u503c\u8bbe\u7f6e\u4e3a”Visual C++”\uff0c\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# declare mylove='Visual C++' <\/pre>\n\n\n\n

\u518d\u4f7f\u7528set\u547d\u4ee4\u5c06\u65b0\u5b9a\u4e49\u7684\u53d8\u91cf\u8f93\u51fa\u4e3a\u73af\u5883\u53d8\u91cf\uff0c\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# set -a mylove  <\/pre>\n\n\n\n

\u6267\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u5c06\u4f1a\u65b0\u6dfb\u52a0\u5bf9\u5e94\u7684\u73af\u5883\u53d8\u91cf\u3002\u7528\u6237\u53ef\u4ee5\u4f7f\u7528env\u547d\u4ee4\u548cgrep\u547d\u4ee4\u5206\u522b\u663e\u793a\u548c\u641c\u7d22\u73af\u5883\u53d8\u91cf”mylove”\uff0c\u8f93\u5165\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# env | grep mylove '<\/pre>\n","protected":false},"excerpt":{"rendered":"

set\u547d\u4ee4\u80fd\u8bbe\u7f6e\u6240\u4f7f\u7528shell\u7684\u6267\u884c\u65b9\u5f0f\uff0c\u53ef\u4f9d\u7167\u4e0d\u540c\u7684\u9700\u6c42\u6765\u505a\u8bbe\u7f6e\u3002 \u8bed\u6cd5\u683c\u5f0f\uff1aset [\u53c2\u6570] \u5e38\u7528\u53c2\u6570\uff1a […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6513"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=6513"}],"version-history":[{"count":3,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6513\/revisions"}],"predecessor-version":[{"id":6557,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6513\/revisions\/6557"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}