At Tue, 18 Dec 2018 10:24:39 -0600, Justin Pryzby <pry...@telsasoft.com> wrote: > I think ON_ERROR_STOP would control whether the script stops, but it should > fail the exit status should reflect any error in the last command. The > shell does that even without set -e.
Let me correct my own language: | I think ON_ERROR_STOP would control whether the script stops, but | the exit status should reflect any error in the last command. The | shell does that even without set -e. What I mean is that "the exit status of the shell reflects the status of the last command". That's why you'll see at the bottom of shscripts an "exit 0" which might seem to be implied. Actually falling off the end of the script is same as "exit" which is same as "exit $?" which may be nonzero if the preceding command was a conditional/test, like: for ... if ... fi done # without this, script will variously "fail" due to conditional evaluating to # false: exit 0 So I'm pointing out serious concern if psql would return 0 if last command failed, a case where it's currently exiting with status 1. Justin