On 6/22/21 5:42 AM, Martin Jambon wrote:
Hello!

I ran into something that looks like a bug to me, although I'm not super familiar curly-brace command groups.

It's not the brace command; it's the pipeline.

Minimal repro:

   $ sleep 1 & { wait $!; } | cat
   [1] 665454
   bash: wait: pid 665454 is not a child of this shell

I was expecting a success, just like we get without the pipeline:

The pipeline does, in fact, make the difference. Each process in a pipeline
is run in a subshell, and that subshell isn't the parent of the previously-
created asynchronous job. You can't wait for a process that isn't one of
your children.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to