SHELL中如何获得管道前面的命令的返回值

To know the exit status of the elements of a pipeline
cmd1 | cmd2 | cmd3
bash
The exit codes are provided in the PIPESTATUS special array.
cmd1 exit code is in ${PIPESTATUS[0]}, cmd3 exit code in
${PIPESTATUS[2]}, so that $? is always the same as
${PIPESTATUS: -1}.

请选择你看完该文章的感受:

0不错 0超赞 0无聊 0扯淡 0不解 0路过

随机文章:

错误代码 720
错误代码 720

水培绿萝
水培绿萝

Windows XP 网络诊断
Windows XP 网络诊断

元宵佳节
元宵佳节

拼图
拼图

wordpress缩略图插件-WP-Thumbnails
wordpress缩略图插件-WP-Thumbnails

发表评论