I have a bash script where I execute a command and tee to a file.
On checking the return code, it is always 0 which is for the tee <> command.
make all | tee output.log
if [[ $? -ne 0 ]]; then
echo "Make failed"
exit 1
else
blah blah
fi
Is there a way to check the return code of the first command (i.e. make all in this case)?