{"id":4692,"date":"2019-08-26T23:42:36","date_gmt":"2019-08-26T15:42:36","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=4692"},"modified":"2019-08-26T23:42:38","modified_gmt":"2019-08-26T15:42:38","slug":"dirname","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/dirname","title":{"rendered":"dirname\u547d\u4ee4 – \u53bb\u9664\u6587\u4ef6\u540d\u4e2d\u7684\u975e\u76ee\u5f55\u90e8\u5206"},"content":{"rendered":"\n

dirname\u547d\u4ee4\u53bb\u9664\u6587\u4ef6\u540d\u4e2d\u7684\u975e\u76ee\u5f55\u90e8\u5206\uff0c\u4ec5\u663e\u793a\u4e0e\u76ee\u5f55\u6709\u5173\u7684\u5185\u5bb9\u3002dirname\u547d\u4ee4\u8bfb\u53d6\u6307\u5b9a\u8def\u5f84\u540d\u4fdd\u7559\u6700\u540e\u4e00\u4e2a\/\u53ca\u5176\u540e\u9762\u7684\u5b57\u7b26\uff0c\u5220\u9664\u5176\u4ed6\u90e8\u5206\uff0c\u5e76\u5199\u7ed3\u679c\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u6700\u540e\u4e00\u4e2a\/\u540e\u65e0\u5b57\u7b26\uff0cdirname \u547d\u4ee4\u4f7f\u7528\u5012\u6570\u7b2c\u4e8c\u4e2a\/\uff0c\u5e76\u5ffd\u7565\u5176\u540e\u7684\u6240\u6709\u5b57\u7b26\u3002dirname \u548c basename \u901a\u5e38\u5728 shell \u5185\u90e8\u547d\u4ee4\u66ff\u6362\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u4e00\u4e2a\u4e0e\u6307\u5b9a\u8f93\u5165\u6587\u4ef6\u540d\u7565\u6709\u5dee\u5f02\u7684\u8f93\u51fa\u6587\u4ef6\u540d\u3002<\/p>\n\n\n\n

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

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n
--help<\/td>\u663e\u793a\u5e2e\u52a9<\/td><\/tr>
--version<\/td>\u663e\u793a\u7248\u672c\u53f7<\/td><\/tr><\/tbody><\/table>\n\n\n\n

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

\u53bb\u9664 \/\/ \u7684\u975e\u76ee\u5f55\u90e8\u5206\u7ed3\u679c\u4e3a \/ \uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# dirname \/\/\n\/<\/pre>\n\n\n\n

\u53bb\u9664 \/a\/b\/ \u7684\u975e\u76ee\u5f55\u90e8\u5206\u7ed3\u679c\u4e3a \/a \uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# dirname \/a\/b\/\n\/a <\/pre>\n\n\n\n

\u53bb\u9664 a \u7684\u975e\u76ee\u5f55\u90e8\u5206\u7ed3\u679c\u4e3a . \uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# dirname a\n.<\/pre>\n\n\n\n

\u53bb\u9664 a\/b \u7684\u975e\u76ee\u5f55\u90e8\u5206\u7ed3\u679c\u4e3a\u8def\u5f84\u540d a \uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# dirname a\/b\na<\/pre>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

dirname\u547d\u4ee4\u53bb\u9664\u6587\u4ef6\u540d\u4e2d\u7684\u975e\u76ee\u5f55\u90e8\u5206\uff0c\u4ec5\u663e\u793a\u4e0e\u76ee\u5f55\u6709\u5173\u7684\u5185\u5bb9\u3002dirname\u547d\u4ee4\u8bfb\u53d6\u6307\u5b9a\u8def\u5f84\u540d\u4fdd\u7559\u6700\u540e\u4e00 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/4692"}],"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=4692"}],"version-history":[{"count":5,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/4692\/revisions"}],"predecessor-version":[{"id":4852,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/4692\/revisions\/4852"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=4692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=4692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=4692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}