Re: Bash: trap vs. tee

2008-07-13 Thread Sven Joachim
On 2008-07-13 18:44 +0200, Stefan Schmidt wrote: >> In bash you can change this behavior with "set -o pipefail". > > Thanks a lot, that works like a treat! One caveat, however: this option was introduced in bash 3, so it will not work with older versions. And of course you need to make sure that

Re: Bash: trap vs. tee

2008-07-13 Thread Stefan Schmidt
> Closing quotes are missing, but your script hopefully has them. Yes, indeed ;) > Because the exit status of the pipe is that of the last command, and tee > has no reason to complain: I was suspecting something like that, but unfortunately I had misinterpreted the output of my debugging variat

Re: Bash: trap vs. tee

2008-07-13 Thread Sven Joachim
On 2008-07-13 17:59 +0200, Stefan Schmidt wrote: > I have a bash script with trap, but the trap doesn't catch the error. > > function handle { > echo "This should be reached Closing quotes are missing, but your script hopefully has them. > exit 1 > } > trap handle ERR > ls nonexist | tee -a outp

Bash: trap vs. tee

2008-07-13 Thread Stefan Schmidt
Hello, I have a bash script with trap, but the trap doesn't catch the error. function handle { echo "This should be reached exit 1 } trap handle ERR ls nonexist | tee -a output.log echo "This should not be reached" outputs ls: nonexist: No such file or directory This should not be reached How