Sujet : Re: Cleaning up background processes
De : geoff (at) *nospam* clare.See-My-Signature.invalid (Geoff Clare)
Groupes : comp.unix.shellDate : 10. May 2024, 13:35:37
Autres entêtes
Message-ID : <ptg1hk-7n3.ln1@ID-313840.user.individual.net>
References : 1 2 3 4 5
User-Agent : Pan/0.154 (Izium; 517acf4)
Janis Papanagnou wrote:
But the pseudo-signal 'EXIT' is non-standard (to my knowledge), so you
cannot generally rely on it, depending on your environment, and the OP
asked for a "standard POSIX shell idiom".
Quoting POSIX.2-1992, 3.14.13:
The condition can be EXIT; 0 (equivalent to EXIT); or a signal
specified using a symbolic name, without the SIG prefix, as listed
in Required Signals and Job Control Signals (Table 3-1 and Table 3-2
in POSIX.1 {8}). (For example: HUP, INT, QUIT, TERM). Setting a
trap for SIGKILL or SIGSTOP produces undefined results.
It has hardly changed in the current standard (POSIX.1-2017):
The condition can be EXIT, 0 (equivalent to EXIT), or a signal
specified using a symbolic name, without the SIG prefix, as listed
in the tables of signal names in the <signal.h> header defined in
XBD Chapter 13; for example, HUP, INT, QUIT, TERM. Implementations
may permit names with the SIG prefix or ignore case in signal
names as an extension. Setting a trap for SIGKILL or SIGSTOP
produces undefined results.
-- Geoff Clare <netnews@gclare.org.uk>