[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
EXIT trap definition order
From: |
Grisha Levit |
Subject: |
EXIT trap definition order |
Date: |
Fri, 17 Mar 2023 13:28:47 -0400 |
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
- EXIT trap definition order,
Grisha Levit <=