开发者

BASH scripting : Command result and pipeline [duplicate]

开发者 https://www.devze.com 2023-03-26 09:23 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: unix shell, getting exit code with piped child
This question already has answers here: Closed 11 years ago.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号