Hello,
I have a question about processing SIGQUIT signal in the subshell.
Why the "original" state for SIGQUIT in subshell is considered as
"core dump", but not ignored as in non-subshell. I guess, it a little
bit confusing.
There is extract from bash manual related to the question.
Signals clause of bash manual claims that:
... In all cases, bash ignores SIGQUIT. ...
The "cases" in question are interactive and non-interactive shells,
with or without job control enabled, and whether `trap' has been used
to change the signal disposition.
Manual for the trap command says:
Trapped signals that are not being ignored are reset to
their original values in a subshell or subshell environment when one
is created.
This isn't exactly it, since you haven't trapped SIGQUIT, but you're on the
right track.
It goes something like this:
The shell ignores SIGQUIT when it starts up, and doesn't allow you to
trap it to reset the handler. When it forks a child, for a subshell or
to execute another program, it resets the handler to whatever it was
when the shell started (SIG_DFL or SIG_IGN).
The man page description of a subshell says
"Command substitution, commands grouped with parentheses, and asynchro-
nous commands are invoked in a subshell environment that is a duplicate
of the shell environment, except that traps caught by the shell are re-
set to the values that the shell inherited from its parent at invoca-
tion."
It should really say "signals" where it says "traps," but you get the
idea -- it means signals that the shell handles specially and signals
that have been trapped using the `trap' command.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/