BASH scripting : Command result and pipeline [duplicate]
Possible Duplicate:
unix shell, getting exit code with piped child
is it possible to have the result of a command (what's usually in $? variable) which is at the beginning of a pipeline ?
eg :
rm -rf filename_to_delete | tee -a log_filename
$? would contai开发者_运维问答n the exit value of the tee statement, how can I have the exit value of the rm statement ?
How do I get the exit code of cmd1 in cmd1|cmd2
精彩评论