Re: why are pipeline commands (allowed to be) executed in subshells?
From:
Philippe Cerfon
Subject:
Re: why are pipeline commands (allowed to be) executed in subshells?
Date:
Tue, 13 Dec 2022 04:48:09 +0100
On Tue, Dec 13, 2022 at 4:39 AM Philippe Cerfon <philcerf@gmail.com> wrote:
>
> Any I have one more… why does this work (tried both interactively,
> non-interactively):
> 1) run a script:
> trap "echo HUP called" HUP
> sleep 1000 &
> wait $!
Ah, forget about the last mail. I found that out myself. POSIX says:
When the shell is waiting, by means of the wait utility, for
asynchronous commands to complete, the reception of a signal for which
a trap has been set shall cause the wait utility to return immediately
with an exit status >128, immediately after which the trap associated
with that signal shall be taken.
Thanks,
Philippe