You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider doing trap '{ s=$?; set +x; } 2>/dev/null; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR to prevent all commands to be printed in case the shell failed while set -x is on. Additionally, other traps are printed, which might be desirable, and the suggested snippet prevents that.
++ s=1
++ echo './script.sh: Error on line 127: COMMAND_LINE_HERE'
./script.sh: Error on line 127: COMMAND_LINE_HERE
++ exit 1
+ rm -rf /tmp/temp-dir.zM0
With this change on, the script fails with:
./script.sh: Error on line 127: COMMAND_LINE_HERE
The text was updated successfully, but these errors were encountered:
Consider doing
trap '{ s=$?; set +x; } 2>/dev/null; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
to prevent all commands to be printed in case the shell failed whileset -x
is on. Additionally, other traps are printed, which might be desirable, and the suggested snippet prevents that.With this change on, the script fails with:
The text was updated successfully, but these errors were encountered: