标签: bash unix shell scripting
可能重复: unix shell, getting exit code with piped child
是否有可能得到一个命令的结果(通常在$?变量中)是在管道的开头?
例如:
rm -rf filename_to_delete | tee -a log_filename
$?将包含tee语句的退出值,如何获得rm语句的退出值?
答案 0 :(得分:1)
How do I get the exit code of cmd1 in cmd1|cmd2