BASH脚本:命令结果和管道

时间:2011-08-04 13:55:05

标签: bash unix shell scripting

  

可能重复:
  unix shell, getting exit code with piped child

是否有可能得到一个命令的结果(通常在$?变量中)是在管道的开头?

例如:

rm -rf filename_to_delete | tee -a log_filename

$?将包含tee语句的退出值,如何获得rm语句的退出值?

1 个答案:

答案 0 :(得分:1)