Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16595

Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'command'

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'command'
Date 2020-07-20 10:14 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.230.1595254488.24492.bug-bash@gnu.org> (permalink)
References <20200719204836.GA1184@mutt> <CAH7i3Lqre0SoX_nJaMis=g7T_+X1LtrsPWJiJCjRCrHT1Y4_Jw@mail.gmail.com> <1659625e-267d-402e-c199-0772820fed79@case.edu> <20200720141119.GA2767@mutt> <6cfd9bdd-a282-0761-1354-1fc5f60703f3@case.edu>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: 'foo > >(bar)' doesn't set $! for external foo not invoked via 'command' Chet Ramey <chet.ramey@case.edu> - 2020-07-20 10:14 -0400

csiph-web