On 11/5/25 11:40 AM, Carsten Finis wrote:
Bash Version: 5.2
Patch Level: 21
Release Status: release
Description:
The man-page says under set -e: "...A trap on ERR, if set, is executed
before the shell exits. ..."
If such a handler sets "set +e", the original flow is resumed after the
handler exits.
I would expect that once the exit due to "set -e" is initiated, it
should not be cancelable.
It's an interesting question. The whole idea behind the ERR trap is to give
the shell programmer more flexibiity than simply exiting (cleanup, print a
warning message, etc.). The current behavior provides that flexibility: if
you don't want to exit, turn off set -e; if you do, leave it alone.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/