[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bash: trap vs. tee



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 come?

Stefan


Reply to: