{"id":290785,"date":"2024-04-09T05:08:33","date_gmt":"2024-04-08T21:08:33","guid":{"rendered":"https:\/\/lrxjmw.cn\/tmlmljsqbjjn.html"},"modified":"2024-04-09T05:08:33","modified_gmt":"2024-04-08T21:08:33","slug":"tmlmljsqbjjn","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/tmlmljsqbjjn.html","title":{"rendered":"\u63a2\u79d8Linux\u547d\u4ee4\u89e3\u91ca\u5668\uff1aBash vs Zsh\uff0c\u7a76\u7adf\u54ea\u4e2a\u66f4\u80dc\u4e00\u7b79\uff1f"},"content":{"rendered":"

1.\u4ec0\u4e48\u662fLinux<\/a>\u547d\u4ee4<\/a>\u89e3\u91ca\u5668<\/b><\/p>\n

Linux\u7684\u547d\u4ee4\u89e3\u91ca\u5668\u2014\u2014\u4e5f\u79f0\u4e3aShell\uff0c\u4f5c\u4e3a\u7528\u6237\u4e0eLinux\u7cfb\u7edf<\/a>\u5185\u6838\u95f4\u7684\u6865\u6881\u7ea2\u5e3d\u5b50linux\uff0c\u627f\u53d7\u4f4f\u7528\u6237\u8f93\u5165\u7684\u5404\u7c7b\u547d\u4ee4\u5e76\u5c06\u5176\u8f6c\u5316\u4e3a\u5185\u6838\u80fd\u7406\u89e3\u7684\u5f62\u5f0f\uff0c\u6765\u5b9e\u73b0\u5185\u90e8\u7684\u4ea4\u4e92\u4ea4\u6d41\u3002Linux\u7cfb\u7edf\u63d0\u4f9b\u4e86\u4f17\u591a\u7c7b\u578b\u7684Shell\uff0c\u5982Bash\u3001Zsh\u4ee5\u53caKsh\u7b49\u7b49\uff0c\u5404\u5177\u7279\u8272\u4e14\u88ab\u5e7f\u6cdb\u4f7f\u7528\u4e8e\u5404\u79cd\u60c5\u5883\u4e2d\u53d1\u6325\u81f3\u5173\u91cd\u8981\u7684\u4f5c\u7528\u3002<\/p>\n

\u5728Linux\u7cfb\u7edf\u7684\u6307\u4ee4\u89e3\u91ca\u5668\u9886\u57df\uff0cBash\uff08Bourne Again Shell\uff09\u51ed\u501f\u5176\u5f3a\u5927\u4e14\u7075\u6d3b\u7684\u7279\u6027\uff0c\u5df2\u6210\u4e3a\u5e7f\u5927\u7528\u6237\u7684\u9996\u9009\u5de5\u5177\u3002\u9664\u6b64\u4e4b\u5916\u514d\u8d39linux\u4e3b\u673a\uff0c\u8bf8\u5982Zsh\uff08Z Shell\uff09\u8fd9\u79cd\u62e5\u6709\u9ad8\u5ea6\u5b9a\u5236\u6027\u4ee5\u53ca\u4e30\u5bcc\u63d2\u4ef6\u7684Shell\u4ea6\u6df1\u53d7\u597d\u8bc4\u3002<\/p>\n

2. Bash - Linux\u9ed8\u8ba4\u547d\u4ee4\u89e3\u91ca\u5668<\/b><\/p>\n

Bash\u4e3aLinux\u7cfb\u7edf\u7684\u9ed8\u8ba4\u547d\u4ee4\u89e3\u91ca\u7a0b\u5e8f\uff0c\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u7c7bLinux\u53d1\u884c\u7248\u672c\u3002\u5176\u5438\u6536\u4e86Bourne Shell\uff08sh\uff09\u7684\u7cbe\u534e\uff0c\u52a0\u4ee5\u6539\u826f\u4e0e\u6269\u5145\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u591a\u6837\u7684\u811a\u672c\u7f16\u7a0b\u53ca\u547d\u4ee4\u884c\u64cd\u4f5c\u529f\u80fd\uff0c\u4f7f\u7528\u6237\u80fd\u8fd0\u7528\u7b80\u6d01\u5f3a\u5065\u7684\u8bed\u6cd5\u8f7b\u677e\u6267\u884c\u5404\u5f0f\u4efb\u52a1\u3002<\/p>\n

Bash\u8d4b\u4e88\u4e86\u7528\u6237\u4f17\u591a\u5185\u7f6e\u53ca\u53ef\u9009\u5916\u7f6e\u529f\u80fd\uff0c\u8986\u76d6\u9762\u5e7f\u6cdb\uff0c\u4ee5\u5b9e\u73b0\u6bcf\u65e5\u6240\u9700\u4efb\u52a1\u3002\u5982\uff0c\u5229\u7528ls\u547d\u4ee4\u663e\u793a\u5f53\u524d\u8def\u5f84\u4e0b\u6587\u4ef6\u53ca\u6587\u4ef6\u5939\u7684\u8be6\u7ec6\u4fe1\u606f\uff1b\u8fd0\u7528cd\u547d\u4ee4\u5b9e\u73b0\u76ee\u5f55\u5207\u6362\uff1b\u518d\u6216\u8005\u501f\u52a9grep\u547d\u4ee4\u5b9e\u65bd\u6587\u672c\u641c\u7d22\u7b49\uff0c\u5747\u4e3a\u76f8\u5173\u6709\u6548\u65b9\u6cd5\u3002\u6b64\u5916linux\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b<\/strong>\uff0c\u8be5\u7cfb\u7edf\u8fd8\u6ce8\u5165\u4e86\u7ba1\u9053\u3001\u91cd\u5b9a\u5411\u3001\u901a\u914d\u7b26\u7b49\u5148\u8fdb\u7279\u6027\uff0c\u5927\u5e45\u5ea6\u63d0\u5347\u4e86\u6587\u4ef6\u6253\u7406\u4e0e\u7a0b\u5e8f\u8fd0\u884c\u6548\u7387\uff0c\u4f7f\u5176\u64cd\u4f5c\u66f4\u4e3a\u4fbf\u6377\u6d41\u7545\u3002<\/p>\n

3. Zsh -\u5f3a\u5927\u4e14\u53ef\u5b9a\u5236\u5316<\/b><\/p>\n

Zsh\uff0c\u8fd9\u662f\u4e00\u6b3e\u62e5\u6709\u5f3a\u5927\u529f\u80fd\u548c\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u6027\u7684\u6807\u51c6\u5206\u8bcd\u547d\u4ee4\u89e3\u6790\u5668\uff0c\u65e8\u5728\u8fdc\u8d85\u4e8eBash(\u5373GNU Bourne Again Shell)\u7684\u4f18\u8d8a\u6027\u4e0a\uff0c\u5e26\u6765\u66f4\u591a\u7684\u73b0\u4ee3\u7279\u6027\u4ee5\u53ca\u66f4\u4e3a\u4fbf\u6377\u76f4\u89c2\u7684\u7528\u6237\u4f7f\u7528\u4f53\u9a8c\u3002Zsh\u4ee5\u5176\u72ec\u7279\u7684\u4f18\u52bf\u7279\u6027\uff0c\u63d0\u4f9b\u8bf8\u5982\u667a\u80fd\u5316\u8865\u5168\u3001\u4e3b\u9898\u5b9a\u5236\u8fd8\u6709\u63d2\u4ef6\u6269\u5c55\u7b49\u591a\u65b9\u9762\u7684\u529f\u80fd\u3002\u8fd9\u4e9b\u4e30\u5bcc\u591a\u6837\u7684\u9009\u9879\u90fd\u4f7f\u5f97\u4f7f\u7528\u8005\u6709\u673a\u4f1a\u4f9d\u636e\u4e2a\u4eba\u504f\u597d\u6253\u9020\u51fa\u9ad8\u5ea6\u4e2a\u6027\u5316\u4e14\u9ad8\u6548\u8fd0\u4f5c\u7684\u5de5\u4f5c\u73af\u5883\u3002<\/p>\n

\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b_linux\u5e38\u89c1\u7684\u547d\u4ee4\u89e3\u6790\u5668_linux\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b<\/p>\n

\u667a\u80fd\u8865\u5168\u4e43\u662fzsh\u5e38\u7528\u4e14\u529f\u80fd\u5f3a\u5927\u7684\u7279\u6027\u4e4b\u4e00\u3002\u5728\u6b64\u9879\u529f\u80fd\u4e0b\uff0c\u4f7f\u7528\u8005\u53ea\u9700\u8f93\u5165\u6307\u4ee4\u6216\u8005\u8def\u5f84\uff0czsh\u4fbf\u80fd\u901a\u8fc7\u667a\u80fd\u5339\u914d\u4e0e\u8bb0\u5fc6\u641c\u7d22\uff0c\u63d0\u4f9b\u6700\u53ef\u80fd\u7684\u8865\u5168\u9009\u9879\uff0c\u663e\u8457\u63d0\u9ad8\u4e86\u8f93\u5165\u901f\u5ea6\u548c\u6548\u7387\u3002\u9664\u6b64\u4e4b\u5916\uff0czsh\u4ea6\u5177\u5907\u5386\u53f2\u8bb0\u5f55\u68c0\u7d22\u4ee5\u53ca\u62fc\u5199\u6821\u6b63\u7b49\u4fbf\u5229\u529f\u80fd\uff0c\u4f7f\u7ec8\u7aef\u64cd\u63a7\u66f4\u4e3a\u6d41\u7545\u81ea\u5982\u3002<\/p>\n

4. Ksh -\u4f01\u4e1a\u7ea7Shell<\/b><\/p>\n

\u7531\u77e5\u540d\u8f6f\u4ef6\u5de5\u7a0b\u5e08\u5927\u536b·\u79d1\u6069\u7814\u53d1\u7684Korn Shell\uff08Ksh\uff09\uff0c\u56e0\u5728\u5404\u7c7b\u4f01\u4e1a\u5e94\u7528\u573a\u5408\u4e2d\u7684\u5e7f\u6cdb\u91c7\u7528linux\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b<\/strong>\uff0c\u800c\u8dfb\u8eab\u4e8e\u6210\u719f\u53ef\u9760\u7684Shell\u4ea7\u54c1\u884c\u5217\u3002\u8be5 shell<\/a>\u6c72\u53d6\u4e86Bourne Shell\uff08sh\uff09\u4e0eC Shell\uff08csh\uff09\u7684\u7cbe\u9ad3\uff0c\u517c\u5177\u4e24\u8005\u4f18\u957f\uff0c\u5e76\u5728\u6b64\u57fa\u7840\u4e0a\u63a8\u51fa\u8bf8\u591a\u521b\u65b0\u7279\u6027\u3002\u5b83\u91c7\u7528\u4e86\u8fd1\u4e4e\u4e8eC\u8bed\u8a00\u7684\u53e5\u6cd5\u89c4\u5219\u8bbe\u8ba1\uff0c\u540c\u65f6\u4e5f\u96c6\u4e30\u5bcc\u5f3a\u5927\u7684\u7a0b\u5e8f\u7f16\u5199\u529f\u80fd\u4e8e\u4e00\u4f53\u3002<\/p>\n

linux\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b_\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b_linux\u5e38\u89c1\u7684\u547d\u4ee4\u89e3\u6790\u5668<\/p>\n

\u5728\u5e94\u5bf9\u7e41\u6742\u903b\u8f91\u65b9\u9762\uff0cKsh\u51ed\u501f\u4e30\u5bcc\u7684\u6761\u4ef6\u5224\u65ad\u3001\u5faa\u73af\u673a\u5236\u4ee5\u53ca\u51fd\u6570\u5b9a\u4e49\u7b49\u7f16\u7a0b\u8bed\u8a00\u7279\u5f81\uff0c\u5c55\u73b0\u51fa\u4e86\u4f18\u5f02\u7684\u6027\u80fd\u3002\u7531\u4e8e\u4f01\u4e1a\u73af\u5883\u5bf9\u7cfb\u7edf\u7a33\u5b9a\u6027\u4e0e\u4fe1\u606f\u5b89\u5168\u6709\u7740\u4e25\u82db\u7684\u8981\u6c42\uff0c\u56e0\u6b64\u9002\u7528\u4e8e\u6b64\u7684Ksh\u4ee5\u5176\u5f3a\u5927\u7684\u53ef\u9760\u6027\u53ca\u5168\u9762\u7684\u529f\u80fd\u800c\u6df1\u53d7\u9752\u7750\u3002<\/p>\n

5. Fish -\u7528\u6237\u53cb\u597d\u578bShell<\/b><\/p>\n

Fish\uff0c\u5373Friendly Interactive Shell\uff0c\u662f\u4e00\u6b3e\u4ee5\u4eba\u6027\u5316\u4e3a\u6838\u5fc3\u8bbe\u8ba1\u7406\u5ff5\u7684\u547d\u4ee4\u89e3\u91ca\u8f6f\u4ef6\u3002\u6b64\u8f6f\u4ef6\u6ce8\u91cd\u7528\u6237\u7684\u64cd\u4f5c\u611f\u53d7\uff0c\u91c7\u7528\u7b80\u6d01\u660e\u4e86\u7684\u754c\u9762\u5e03\u5c40\u53ca\u4e30\u5bcc\u5b9e\u7528\u7684\u529f\u80fd\u7279\u6027\u3002\u76f8\u8f83\u4e8e\u4f20\u7edfShell\uff0cFish\u5177\u5907\u66f4\u4f73\u7684\u9519\u8bef\u63d0\u793a\u7cfb\u7edf\u3001\u7cbe\u786e\u7684\u8bed\u6cd5\u9ad8\u4eae\u5c55\u793a\u548c\u667a\u80fd\u5316\u7684\u81ea\u52a8\u8865\u5168\u5efa\u8bae\u7b49\u4f18\u70b9\uff0c\u6781\u5927\u5730\u63d0\u5347\u4e86\u7528\u6237\u4f7f\u7528\u6548\u7387\u3002<\/p>\n

linux\u5e38\u89c1\u7684\u547d\u4ee4\u89e3\u6790\u5668_linux\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b_\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b<\/p>\n

Fish\u4ee5\u72ec\u7279\u6613\u8bb0\u7684\u8bed\u6cd5\u548c\u8be6\u5c3d\u53cb\u5584\u7684\u5e2e\u52a9\u624b\u518c\u7acb\u8db3\uff0c\u65e0\u8bba\u65b0\u624b\u4ecd\u5f97\u4ee5\u8fc5\u901f\u638c\u63e1\u5176\u65b9\u4fbf\u6027\u3002\u5c3d\u7ba1\u5176\u4e0e\u4f20\u7edfShell\u6709\u6240\u533a\u522b\uff0c\u7136\u800c\u5176\u65b0\u9896\u8bbe\u8ba1\u4f7f\u5176\u6210\u4e3a\u7099\u624b\u53ef\u70ed\u7684\u5168\u65b0\u4ee3Shell\u5de5\u5177\u3002<\/p>\n

6.\u5176\u4ed6\u5e38\u89c1Shell<\/b><\/p>\n

\u9664\u5e02\u9762\u4e0a\u5e38\u89c1\u7684\u51e0\u4e2aShell\u4ee5\u5916\uff0cLinux\u4e0a\u8fd8\u6709\u8bf8\u5982C Shell\uff08\u7b80\u79f0 csh\uff09\u3001Tcsh\uff08\u5168\u79f0 Tenex C Shell\uff09\u4ee5\u53caDash\u7b49\u4f17\u591a\u7c7b\u578b\u7684\u89e3\u91ca\u5668\uff0c\u5404\u5177\u7279\u8272\u4e14\u9002\u7528\u4e8e\u5404\u79cd\u7279\u5b9a\u573a\u5408\u3002<\/p>\n

\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b_linux\u547d\u4ee4\u89e3\u91ca\u5668\u6709\u54ea\u4e9b_linux\u5e38\u89c1\u7684\u547d\u4ee4\u89e3\u6790\u5668<\/p>\n

C Shell\u4ee5\u5176\u4e0eC\u8bed\u8a00\u76f8\u4f3c\u7684\u8bed\u6cd5\u89c4\u5219\u800c\u95fb\u540d\uff0c\u5f97\u5230\u4e86\u5305\u62ecUNIX\u5728\u5185\u7684\u591a\u79cd\u7cfb\u7edf\u7684\u8ba4\u53ef\u5e94\u7528\uff1b\u800cTcsh\u4f5c\u4e3aC Shell\u7684\u5347\u7ea7\u7248\u672c\uff0c\u5728\u4ea4\u4e92\u5f0f\u64cd\u4f5c\u4f53\u9a8c\u65b9\u9762\u5c55\u73b0\u51fa\u4f18\u8d8a\u6027\uff1b\u6700\u540e\uff0cDebian Linux\u6240\u91c7\u7528\u7684\u9ed8\u8ba4Shell\u2014\u2014Dash\uff0c\u56e0\u5176\u8f7b\u4fbf\u5feb\u901f\u4e14\u5bf9\u7cfb\u7edf\u8d44\u6e90\u5360\u7528\u8f83\u5c11\u7684\u7279\u70b9\u8868\u73b0\u51fa\u8272\u3002<\/p>\n

7.\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684Linux\u547d\u4ee4\u89e3\u91ca\u5668<\/b><\/p>\n

\u9488\u5bf9Linux\u547d\u4ee4\u89e3\u91ca\u5668\u7684\u9009\u53d6\uff0c\u7efc\u5408\u8003\u91cf\u4e2a\u4eba\u9700\u6c42\u3001\u4f7f\u7528\u504f\u597d\u53ca\u5de5\u4f5c\u73af\u5883\u7b49\u76f8\u5173\u56e0\u7d20\u81f3\u5173\u91cd\u8981\u3002\u82e5\u4fa7\u91cd\u4e8e\u5176\u7075\u6d3b\u6027\u548c\u901a\u7528\u6027\uff0c\u540c\u65f6\u6e34\u671b\u83b7\u5f97\u4e13\u5bb6\u4eec\u7684\u5e7f\u535a\u652f\u6301\uff0c\u90a3\u4e48Bash\u5b9e\u4e3a\u4e0a\u4f73\u4e4b\u9009\uff1b\u82e5\u671f\u671b\u62e5\u6709\u9ad8\u5ea6\u4e2a\u6027\u5316\u5b9a\u5236\u4e0e\u9ad8\u6548\u6267\u884c\u80fd\u529b\uff0c\u90a3\u4e48Zsh\u6216Fish\u65e0\u7591\u66f4\u4e3a\u9002\u5b9c\uff1b\u76f8\u53cd\uff0c\u82e5\u662f\u8eab\u5904\u4f01\u4e1a\u73af\u5883\u4e14\u5bf9\u7a33\u5b9a\u6027\u4e0e\u53ef\u9760\u6027\u6709\u7740\u6781\u9ad8\u8981\u6c42\uff0cKsh\u4fbf\u53ef\u80fd\u662f\u6700\u4f73\u9009\u62e9\u3002<\/p>\n

\u4e0d\u8bba\u60a8\u9009\u53d6\u4f55\u79cdLinux\u6307\u4ee4\u89e3\u91ca\u5668\uff0c\u5b83\u5728\u719f\u7ec3\u638c\u63e1\u57fa\u7840\u64cd\u4f5c\u6280\u672f\u540e\u5747\u80fd\u52a9\u529b\u66f4\u9ad8\u6548\u7684\u7cfb\u7edf\u7ba1\u7406\u3001\u811a\u672c\u5b9a\u5236\u4ee5\u53ca\u5404\u7c7b\u4efb\u52a1\u6267\u884c\u3002\u4e3a\u4e86\u66f4\u597d\u5730\u63d0\u9ad8\u6548\u7387\uff0c\u5efa\u8bae\u5728\u5b9e\u9645\u5e94\u7528\u8fc7\u7a0b\u4e2d\u591a\u8bd5\u51e0\u79cdShell\uff0c\u6839\u636e\u5b9e\u9645\u9700\u6c42\u6311\u9009\u6700\u9002\u5408\u81ea\u5df1\u7684\u5de5\u5177\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4ec0\u4e48\u662fLinux\u547d\u4ee4\u89e3\u91ca\u5668Linux\u9ed8\u8ba4\u547d\u4ee4\u89e3\u91ca\u5668\u5982\uff0c\u5229\u7528ls\u547d\u4ee4\u663e\u793a\u5f53\u524d\u8def\u5f84\u4e0b\u6587\u4ef6\u53ca\u6587\u4ef6\u5939\u7684\u8be6\u7ec6\u4fe1\u606f\uff1b\u8fd0\u7528cd\u547d\u4ee4\u5b9e\u73b0\u76ee\u5f55\u5207\u6362\uff1b\u518d\u6216\u8005\u501f\u52a9grep\u547d\u4ee4\u5b9e\u65bd\u6587\u672c\u641c\u7d22\u7b49\uff0c\u5747\u4e3a\u76f8\u5173\u6709\u6548\u65b9\u6cd5\u3002\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684Linux\u547d\u4ee4\u89e3\u91ca\u5668<\/p>\n","protected":false},"author":1,"featured_media":290786,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-290785","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/290785","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=290785"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/290785\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/290786"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=290785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=290785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=290785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}