{"id":2450,"date":"2015-11-01T23:59:03","date_gmt":"2015-11-01T15:59:03","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2450"},"modified":"2015-11-01T23:59:03","modified_gmt":"2015-11-01T15:59:03","slug":"bash%e4%b8%ad%e5%a6%82%e4%bd%95%e8%8e%b7%e5%8f%96%e6%89%80%e6%9c%89%e7%ae%a1%e9%81%93%e5%91%bd%e4%bb%a4%e7%9a%84%e8%bf%94%e5%9b%9e%e5%80%bc","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2450.html","title":{"rendered":"Bash\u4e2d\u5982\u4f55\u83b7\u53d6\u6240\u6709\u7ba1\u9053\u547d\u4ee4\u7684\u8fd4\u56de\u503c"},"content":{"rendered":"<p>=Start=<\/p>\n<h6>\u641c\u7d22\u5173\u952e\u5b57\uff1a<\/h6>\n<p>linux how to get all pipe return value<\/p>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/unix.stackexchange.com\/questions\/14270\/get-exit-status-of-process-thats-piped-to-another\" target=\"_blank\">http:\/\/unix.stackexchange.com\/questions\/14270\/get-exit-status-of-process-thats-piped-to-another<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/6871859\/piping-command-output-to-tee-but-also-save-exit-code-of-command\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/6871859\/piping-command-output-to-tee-but-also-save-exit-code-of-command<\/a><\/li>\n<li><a href=\"http:\/\/tldp.org\/LDP\/abs\/html\/internalvariables.html#PIPESTATUSREF\" target=\"_blank\">http:\/\/tldp.org\/LDP\/abs\/html\/internalvariables.html#PIPESTATUSREF<\/a><\/li>\n<\/ul>\n<h6>\u53c2\u8003\u89e3\u7b54\uff1a<\/h6>\n<p>$PIPESTATUS \u6570\u7ec4\uff08\u5728Zsh\u4e2d\u662f\u5c0f\u5199\uff09<\/p>\n<pre class=\"lang:default decode:true \"># Bash\n$ false | true\n$ echo \"${PIPESTATUS[0]} ${PIPESTATUS[1]}\"\n1 0\n\n# Zsh\n$ false | true\n$ echo \"${pipestatus[1]} ${pipestatus[2]}\"\n1 0<\/pre>\n<pre class=\"lang:default decode:true\"># Zsh\n$ echo $0\n-zsh\n$ echo $ZSH_VERSION\n5.0.5\n$ ls | bogus_command | wc\nzsh: command not found: bogus_command\n       0       0       0\n$ echo ${pipestatus[@]}\n0 127 0<\/pre>\n<p>=EOF=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u641c\u7d22\u5173\u952e\u5b57\uff1a linux how to get all pipe return value \u53c2 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,11,7],"tags":[83,556,557],"class_list":["post-2450","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-linux","category-programing","tag-bash","tag-pipe","tag-zsh"],"views":2262,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2450"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2450\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}