It seems that if a trap handler for a terminating signal resends its
own signal (after resetting the signal disposition), any configured
EXIT trap will be executed (as I think is expected), but only if an
EXIT trap had already been set prior to the the first instance of a
trap having been set for the terminating signal in question.

That is, this script will print "EXIT":

trap 'echo EXIT' EXIT
trap 'trap TERM; kill 0' TERM
kill 0

Whereas this one will not:

trap 'trap TERM; kill 0' TERM
trap 'echo EXIT' EXIT
kill 0

Reply via email to