\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5206\u4eab 10 \u4e2a\u5199\u51fa\u9ad8\u6548\u53ef\u9760\u7684 bash \u811a\u672c\u7684\u5b9e\u7528\u6280\u5de7\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\nShell \u811a\u672c\u7f16\u7a0b \u662f\u4f60\u5728 Linux \u4e0b\u5b66\u4e60\u6216\u7ec3\u4e60\u7f16\u7a0b\u7684\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u3002\u5c24\u5176\u5bf9 \u7cfb\u7edf\u7ba1\u7406\u5458\u8981\u5904\u7406\u7740\u81ea\u52a8\u5316\u4efb\u52a1\uff0c\u4e14\u8981\u5f00\u53d1\u65b0\u7684\u7b80\u5355\u7684\u5b9e\u7528\u7a0b\u5e8f\u6216\u5de5\u5177\u7b49\uff08\u8fd9\u91cc\u53ea\u662f\u4ec5\u4e3e\u51e0\u4f8b\uff09\u66f4\u662f\u5fc5\u5907\u6280\u80fd\u3002
\n\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u5206\u4eab 10 \u4e2a\u5199\u51fa\u9ad8\u6548\u53ef\u9760\u7684 bash \u811a\u672c\u7684\u5b9e\u7528\u6280\u5de7\uff0c\u5b83\u4eec\u5305\u62ec\uff1a
\n1\u3001 \u811a\u672c\u4e2d\u591a\u5199\u6ce8\u91ca
\n\u8fd9\u662f\u4e0d\u4ec5\u53ef\u5e94\u7528\u4e8e shell \u811a\u672c\u7a0b\u5e8f\u4e2d\uff0c\u4e5f\u53ef\u7528\u5728\u5176\u4ed6\u6240\u6709\u7c7b\u578b\u7684\u7f16\u7a0b\u4e2d\u7684\u4e00\u79cd\u63a8\u8350\u505a\u6cd5\u3002\u5728\u811a\u672c\u4e2d\u4f5c\u6ce8\u91ca\u80fd\u5e2e\u4f60\u6216\u522b\u4eba\u7ffb\u9605\u4f60\u7684\u811a\u672c\u65f6\u4e86\u89e3\u811a\u672c\u7684\u4e0d\u540c\u90e8\u5206\u6240\u505a\u7684\u5de5\u4f5c\u3002
\n\u5bf9\u4e8e\u521a\u5165\u95e8\u7684\u4eba\u6765\u8bf4\uff0c\u6ce8\u91ca\u7528 # \u53f7\u6765\u5b9a\u4e49\u3002
\n# TecMint \u662f\u6d4f\u89c8\u5404\u7c7b Linux \u6587\u7ae0\u7684\u6700\u4f73\u7ad9\u70b9
\n2\u3001 \u5f53\u8fd0\u884c\u5931\u8d25\u65f6\u4f7f\u811a\u672c\u9000\u51fa
\n\u6709\u65f6\u5373\u4f7f\u67d0\u4e9b\u547d\u4ee4\u8fd0\u884c\u5931\u8d25\uff0cbash \u53ef\u80fd\u7ee7\u7eed\u53bb\u6267\u884c\u811a\u672c\uff0c\u8fd9\u6837\u5c31\u5f71\u54cd\u5230\u811a\u672c\u7684\u5176\u4f59\u90e8\u5206\uff08\u4f1a\u6700\u7ec8\u5bfc\u81f4\u903b\u8f91\u9519\u8bef\uff09\u3002\u7528\u4e0b\u9762\u7684\u884c\u7684\u65b9\u5f0f\u5728\u9047\u5230\u547d\u4ee4\u5931\u8d25\u65f6\u6765\u9000\u51fa\u811a\u672c\u6267\u884c\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n3\u3001 \u5f53 Bash \u7528\u672a\u58f0\u660e\u53d8\u91cf\u65f6\u4f7f\u811a\u672c\u9000\u51fa
\nBash \u4e5f\u53ef\u80fd\u4f1a\u4f7f\u7528\u80fd\u5bfc\u81f4\u8d77\u903b\u8f91\u9519\u8bef\u7684\u672a\u58f0\u660e\u7684\u53d8\u91cf\u3002\u56e0\u6b64\u7528\u4e0b\u9762\u884c\u7684\u65b9\u5f0f\u53bb\u901a\u77e5 bash \u5f53\u5b83\u5c1d\u8bd5\u53bb\u7528\u4e00\u4e2a\u672a\u58f0\u660e\u53d8\u91cf\u65f6\u5c31\u9000\u51fa\u811a\u672c\u6267\u884c\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n4\u3001 \u4f7f\u7528\u53cc\u5f15\u53f7\u6765\u5f15\u7528\u53d8\u91cf
\n\u5f53\u5f15\u7528\u65f6\uff08\u4f7f\u7528\u4e00\u4e2a\u53d8\u91cf\u7684\u503c\uff09\u7528\u53cc\u5f15\u53f7\u6709\u52a9\u4e8e\u9632\u6b62\u7531\u4e8e\u7a7a\u683c\u5bfc\u81f4\u5355\u8bcd\u5206\u5272\u5f00\u548c\u7531\u4e8e\u8bc6\u522b\u548c\u6269\u5c55\u4e86\u901a\u914d\u7b26\u800c\u5bfc\u81f4\u7684\u4e0d\u5fc5\u8981\u5339\u914d\u3002
\n\u770b\u770b\u4e0b\u9762\u7684\u4f8b\u5b50\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\uff0c\u63a5\u7740\u5982\u4e0b\u8fd0\u884c\u4e00\u4e0b\uff1a
\n
\n$ .\/names.sh
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n\u5728\u811a\u672c\u4e2d\u7528\u53cc\u5f15\u53f7
\n5\u3001 \u5728\u811a\u672c\u4e2d\u4f7f\u7528\u51fd\u6570
\n\u9664\u4e86\u975e\u5e38\u5c0f\u7684\u811a\u672c\uff08\u53ea\u6709\u51e0\u884c\u4ee3\u7801\uff09\uff0c\u603b\u662f\u8bb0\u5f97\u7528\u51fd\u6570\u6765\u4f7f\u4ee3\u7801\u6a21\u5757\u5316\u4e14\u4f7f\u5f97\u811a\u672c\u66f4\u53ef\u8bfb\u548c\u53ef\u91cd\u7528\u3002
\n\u5199\u51fd\u6570\u7684\u8bed\u6cd5\u5982\u4e0b\u6240\u793a\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n\u5199\u6210\u5355\u884c\u4ee3\u7801\u65f6\uff0c\u6bcf\u4e2a\u547d\u4ee4\u540e\u8981\u7528\u7ec8\u6b62\u7b26\u53f7\uff1a
\ncheck_root(){ command1; command2; }
\n6\u3001 \u5b57\u7b26\u4e32\u6bd4\u8f83\u65f6\u7528 = \u800c\u4e0d\u662f ==
\n\u6ce8\u610f == \u662f = \u7684\u540c\u4e49\u8bcd\uff0c\u56e0\u6b64\u4ec5\u7528\u4e2a\u5355 = \u6765\u505a\u5b57\u7b26\u4e32\u6bd4\u8f83\uff0c\u4f8b\u5982\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n7\u3001 \u7528 $(command) \u800c\u4e0d\u662f\u8001\u65e7\u7684 command \u6765\u505a\u4ee3\u6362
\n\u547d\u4ee4\u4ee3\u6362 \u662f\u7528\u8fd9\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u7ed3\u679c\u53d6\u4ee3\u547d\u4ee4\u672c\u8eab\u3002\u7528 $(command) \u800c\u4e0d\u662f\u5f15\u53f7 command \u6765\u505a\u547d\u4ee4\u4ee3\u6362\u3002
\n\u8fd9\u79cd\u505a\u6cd5\u4e5f\u662f shellcheck tool \uff08\u53ef\u9488\u5bf9 shell \u811a\u672c\u663e\u793a\u8b66\u544a\u548c\u5efa\u8bae\uff09\u6240\u5efa\u8bae\u7684\u3002\u4f8b\u5982\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n8\u3001 \u7528 readonly \u6765\u58f0\u660e\u9759\u6001\u53d8\u91cf
\n\u9759\u6001\u53d8\u91cf\u4e0d\u4f1a\u6539\u53d8\uff1b\u5b83\u7684\u503c\u4e00\u65e6\u5728\u811a\u672c\u4e2d\u5b9a\u4e49\u540e\u4e0d\u80fd\u88ab\u4fee\u6539\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n9\u3001 \u73af\u5883\u53d8\u91cf\u7528\u5927\u5199\u5b57\u6bcd\u547d\u540d\uff0c\u800c\u81ea\u5b9a\u4e49\u53d8\u91cf\u7528\u5c0f\u5199
\n\u6240\u6709\u7684 bash \u73af\u5883\u53d8\u91cf\u7528\u5927\u5199\u5b57\u6bcd\u53bb\u547d\u540d\uff0c\u56e0\u6b64\u7528\u5c0f\u5199\u5b57\u6bcd\u6765\u547d\u540d\u4f60\u7684\u81ea\u5b9a\u4e49\u53d8\u91cf\u4ee5\u907f\u514d\u53d8\u91cf\u540d\u51b2\u7a81\uff1a
\n
\nLinux \u4e2d\u9ad8\u6548\u7f16\u5199 Bash \u811a\u672c\u7684 10 \u4e2a\u6280\u5de7
\n10\u3001 \u603b\u662f\u5bf9\u957f\u811a\u672c\u8fdb\u884c\u8c03\u8bd5
\n\u5982\u679c\u4f60\u5728\u5199\u6709\u6570\u5343\u884c\u4ee3\u7801\u7684 bash \u811a\u672c\uff0c\u6392\u9519\u53ef\u80fd\u53d8\u6210\u5669\u68a6\u3002\u4e3a\u4e86\u5728\u811a\u672c\u6267\u884c\u524d\u6613\u4e8e\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u8981\u8fdb\u884c\u4e00\u4e9b\u8c03\u8bd5\u3002\u540e\u7eed\u4f1a\u66f4\u65b0\u4e00\u7bc7\u6307\u5357\u6765\u8ba9\u5927\u5bb6\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\uff1a
\n\u5982\u4f55\u5728 Linux \u4e2d\u542f\u7528 Shell \u811a\u672c\u8c03\u8bd5\u6a21\u5f0f
\n\u5982\u4f55\u5728 Shell \u811a\u672c\u4e2d\u6267\u884c\u8bed\u6cd5\u68c0\u67e5\u8c03\u8bd5\u6a21\u5f0f
\n\u5982\u4f55\u5728 Shell \u811a\u672c\u4e2d\u8ddf\u8e2a\u8c03\u8bd5\u547d\u4ee4\u7684\u6267\u884c<\/p>\n","protected":false},"excerpt":{"rendered":"
Shell \u811a\u672c\u7f16\u7a0b \u662f\u4f60\u5728 Linux \u4e0b\u5b66\u4e60\u6216\u7ec3\u4e60\u7f16\u7a0b\u7684\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u3002\u5c24\u5176\u5bf9 \u7cfb\u7edf\u7ba1\u7406\u5458\u8981\u5904\u7406\u7740\u81ea\u52a8\u5316\u4efb\u52a1 […]<\/p>\n","protected":false},"author":1469,"featured_media":166739,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-166727","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/166727","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\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=166727"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/166727\/revisions"}],"predecessor-version":[{"id":166790,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/166727\/revisions\/166790"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/166739"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=166727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=166727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=166727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}