0

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 contain the exit value of the tee statement, how can I have the exit value of the rm statement ?

Community
  • 1
  • 1
Jack
  • 23
  • 3

1 Answers1

1

How do I get the exit code of cmd1 in cmd1|cmd2

Sjoerd
  • 74,049
  • 16
  • 131
  • 175