diff --git a/mail_wrap_script.sh b/mail_wrap_script.sh index c5a1356..2452287 100755 --- a/mail_wrap_script.sh +++ b/mail_wrap_script.sh @@ -10,7 +10,7 @@ touch /tmp/$FILE_ID.log chmod a-rwx,u+r /tmp/$FILE_ID.log $SCRIPT "$@" 2>&1 | tee /tmp/$FILE_ID.log -ERR=$? +ERR=${PIPESTATUS[0]} OUTPUT=$(cat /tmp/$FILE_ID.log) rm /tmp/$FILE_ID.log