[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'comm
From: |
Rusty Bird |
Subject: |
Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'command' |
Date: |
Mon, 20 Jul 2020 14:11:19 +0000 |
Chet Ramey:
> >> Description:
> >> $! isn't set to the PID of 'bar' for
> >>
> >> foo > >(bar)
> >>
> >> if 'foo' is an external program (as opposed to a builtin or
> >> function) - unless it's invoked via 'command'.
>
> Redirections are performed in the subshell created to execute `foo', so the
> process substitution is invoked there and can't affect the parent's $!.
I guess my question is: Would it not make sense to always perform the
redirection before the subshell is created?
OTOH, looks like it's trivial to work around the issue by using
'{ foo; } > >(bar)'.
Rusty
signature.asc
Description: PGP signature