[Top][All Lists]

[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: Chet Ramey
Subject: Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'command'
Date: Mon, 20 Jul 2020 10:14:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 7/20/20 10:11 AM, Rusty Bird wrote:
> 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?

You could make a case for it, but I'm not inclined to invalidate 30+ years
of bash backward compatibility unless the reason is a lot more compelling.

``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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]