Liste des Groupes | Revenir à cu shell |
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.
Les messages affichés proviennent d'usenet.