{"id":51990,"date":"2024-12-03T17:37:00","date_gmt":"2024-12-03T09:37:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/51990\/"},"modified":"2024-12-03T17:37:00","modified_gmt":"2024-12-03T09:37:00","slug":"linux%e8%bf%90%e8%a1%8c%e6%96%87%e4%bb%b6%e7%9a%84%e5%91%bd%e4%bb%a4%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/51990\/","title":{"rendered":"linux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>linux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48<\/h1>\n<p>\u6765\u5230\u7c73\u4e91\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6587\u7ae0\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300alinux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<\/p>\n<blockquote>\n<p>linux\u8fd0\u884c\u6587\u4ef6\u547d\u4ee4\u6709\uff1a1\u3001\u4f7f\u7528source\u6267\u884c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201csource \u6587\u4ef6\u540d\u201d\u30022\u3001\u5229\u7528\u201c.\u201d\u6267\u884c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201c. &nbsp;\u6587\u4ef6\u540d\u201d\u30023\u3001\u4f7f\u7528bash\u6267\u884c\u811a\u672c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201cbash \u6587\u4ef6\u540d\u201d\u30024\u3001\u4f7f\u7528\u201c.\/file\u201d\u6267\u884c\u811a\u672c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201c.\/\u6587\u4ef6\u540d\u201d\uff1b\u6b64\u79cd\u65b9\u5f0f\u9996\u5148\u5f97\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650\u201cchmod +x \u6587\u4ef6\u540d\u201d\u3002<\/p>\n<\/blockquote>\n<p><strong>\u521b\u5efa\u6587\u4ef6<\/strong><\/p>\n<pre>vi&nbsp;test.txt\n#&nbsp;\u6309i\u5207\u6362insert\u6a21\u5f0f\n#&nbsp;\u8f93\u5165\u6587\u672c\n#\uff01\/bin\/bash\necho&nbsp;\"Hello&nbsp;world\uff01\uff01\uff01\"\necho&nbsp;$$&nbsp;#&nbsp;\u6253\u5370\u5f53\u524d\u8fdb\u7a0bid\necho&nbsp;$test<\/pre>\n<p><strong>\u6267\u884c(\u8fd0\u884c)\u6587\u4ef6\u7684\u65b9\u5f0f<\/strong><\/p>\n<p><strong>1\u3001 \u4f7f\u7528source\u6267\u884c\u811a\u672c<\/strong><\/p>\n<pre>test=100\nsource&nbsp;test.txt<\/pre>\n<p>\u8f93\u51fa\uff1a<\/p>\n<pre>Hello&nbsp;world!!!\n37790\n100<\/pre>\n<p>\u4f7f\u7528\u7684\u4e3a\u5f53\u524dbash<\/p>\n<p><strong>2\u3001 \u4f7f\u7528.\u6267\u884c\u811a\u672c<\/strong><\/p>\n<pre>.&nbsp;test.txt&nbsp;\nHello&nbsp;world!!!\n37790\n100<\/pre>\n<p>\u4f7f\u7528\u7684\u4e3a\u5f53\u524dbash<\/p>\n<p><strong>3\u3001 \u4f7f\u7528bash\u6267\u884c\u811a\u672c<\/strong><\/p>\n<pre>bash&nbsp;test.txt&nbsp;\nHello&nbsp;world!!!\n47733<\/pre>\n<p>\u8fdb\u7a0bid\u66f4\u65b0\u4e86\uff0c\u4e14\u672a\u83b7\u53d6\u5230\u53d8\u91cftest\u7684\u503c\uff0c\u56e0\u4e3a\u542f\u52a8\u4e86\u5b50\u8fdb\u7a0b\u7684bash\u6267\u884c\u811a\u672c\u3002<\/p>\n<p><strong>4\u3001 \u4f7f\u7528.\/file\u6267\u884c\u811a\u672c<\/strong><\/p>\n<p>\u6ce8\u610f\uff1a\u6b64\u79cd\u65b9\u5f0f\u9996\u5148\u5f97\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650 chmod +x test.txt<\/p>\n<pre>.\/test.txt&nbsp;\nHello&nbsp;world!!!\n47758<\/pre>\n<p>\u8fdb\u7a0bid\u66f4\u65b0\u4e86\uff0c\u4e14\u672a\u83b7\u53d6\u5230\u53d8\u91cftest\u7684\u503c\uff0c\u56e0\u4e3a\u542f\u52a8\u4e86\u5b50\u8fdb\u7a0b\u7684bash\u6267\u884c\u811a\u672c\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300alinux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48 \u6765\u5230\u7c73\u4e91\u7684\u5927\u5bb6\uff0c\u76f8\u4fe1\u90fd\u662f\u7f16\u7a0b\u5b66\u4e60\u7231\u597d\u8005\uff0c\u5e0c\u671b\u5728\u8fd9\u91cc\u5b66\u4e60\u6587\u7ae0\u76f8\u5173\u7f16\u7a0b\u77e5\u8bc6\u3002\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u5e26\u5927\u5bb6\u804a\u804a\u300alinux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\u300b\uff0c\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 linux\u8fd0\u884c\u6587\u4ef6\u547d\u4ee4\u6709\uff1a1\u3001\u4f7f\u7528source\u6267\u884c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201csource \u6587\u4ef6\u540d\u201d\u30022\u3001\u5229\u7528\u201c.\u201d\u6267\u884c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201c. &nbsp;\u6587\u4ef6\u540d\u201d\u30023\u3001\u4f7f\u7528bash\u6267\u884c\u811a\u672c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201cbash \u6587\u4ef6\u540d\u201d\u30024\u3001\u4f7f\u7528\u201c.\/file\u201d\u6267\u884c\u811a\u672c\u6587\u4ef6\uff0c\u547d\u4ee4\u8bed\u6cd5\u4e3a\u201c.\/\u6587\u4ef6\u540d\u201d\uff1b\u6b64\u79cd\u65b9\u5f0f\u9996\u5148\u5f97\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650\u201cchmod +x \u6587\u4ef6\u540d\u201d\u3002 \u521b\u5efa\u6587\u4ef6 vi&nbsp;test.txt #&nbsp;\u6309i\u5207\u6362insert\u6a21\u5f0f #&nbsp;\u8f93\u5165\u6587\u672c #\uff01\/bin\/bash echo&nbsp;&#8220;Hello&nbsp;world\uff01\uff01\uff01&#8221; echo&nbsp;$$&nbsp;#&nbsp;\u6253\u5370\u5f53\u524d\u8fdb\u7a0bid echo&nbsp;$test \u6267\u884c(\u8fd0\u884c)\u6587\u4ef6\u7684\u65b9\u5f0f 1\u3001 \u4f7f\u7528source\u6267\u884c\u811a\u672c test=100 source&nbsp;test.txt \u8f93\u51fa\uff1a Hello&nbsp;world!!! 37790 100 \u4f7f\u7528\u7684\u4e3a\u5f53\u524dbash 2\u3001 \u4f7f\u7528.\u6267\u884c\u811a\u672c .&nbsp;test.txt&nbsp; Hello&nbsp;world!!! 37790 100 \u4f7f\u7528\u7684\u4e3a\u5f53\u524dbash 3\u3001 \u4f7f\u7528bash\u6267\u884c\u811a\u672c bash&nbsp;test.txt&nbsp; Hello&nbsp;world!!! 47733 \u8fdb\u7a0bid\u66f4\u65b0\u4e86\uff0c\u4e14\u672a\u83b7\u53d6\u5230\u53d8\u91cftest\u7684\u503c\uff0c\u56e0\u4e3a\u542f\u52a8\u4e86\u5b50\u8fdb\u7a0b\u7684bash\u6267\u884c\u811a\u672c\u3002 4\u3001 \u4f7f\u7528.\/file\u6267\u884c\u811a\u672c \u6ce8\u610f\uff1a\u6b64\u79cd\u65b9\u5f0f\u9996\u5148\u5f97\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650 chmod +x test.txt .\/test.txt&nbsp; Hello&nbsp;world!!! 47758 \u8fdb\u7a0bid\u66f4\u65b0\u4e86\uff0c\u4e14\u672a\u83b7\u53d6\u5230\u53d8\u91cftest\u7684\u503c\uff0c\u56e0\u4e3a\u542f\u52a8\u4e86\u5b50\u8fdb\u7a0b\u7684bash\u6267\u884c\u811a\u672c\u3002 \u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300alinux\u8fd0\u884c\u6587\u4ef6\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-51990","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=51990"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51990\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=51990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=51990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=51990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}