Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 4.3.11 TRAPEXIT() on cygwin



On Tue, 11 Jan 2011 02:50 +0100, "Mikael Magnusson" <mikachu@xxxxxxxxx>
wrote:
> > echo $( trap 'echo exiting' EXIT)
> >
> > or similar substitutions.  That's quite clearly a subshell entering to
> > the same extent a ( ... ) is.
> 
> How is that different from what you wrote?

Well, the examples you quote are traps set within a subshell, which may
or may not propagate higher.

My problem is that the subshell is inheriting the parent trap action.

That seems obviously different, and POSIX seems pretty clear:

    When a subshell is entered, traps that are not being ignored shall
    be set to the default actions, except in the case of a command
    substitution containing only a single trap command, when the traps
    need not be altered.

Anthony



Messages sorted by: Reverse Date, Date, Thread, Author