help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] What the process started by <() may not be a child?


From: Russell Lewis
Subject: Re: [Help-bash] What the process started by <() may not be a child?
Date: Thu, 15 Nov 2018 10:53:51 -0700

My trick for waiting for multiple process-substitution is to append a cat
command to the end of the line.  It suspect that it doesn't work for all
possible combinations of commands, and it also adds to overhead (since all
I/O is copied through another process), but for many of the simple tasks I
do, it works well:
    echo <(cmd1) <(cmd2) | cat

Russ

On Thu, Nov 15, 2018 at 8:04 AM Peng Yu <address@hidden> wrote:

> Hi,
>
> I don't understand the difference between the two <(). Why the first
> one is not a child but the second one is a child? Where is this
> documented? If I do want to wait for both to be finished, is there a
> way to do so in bash? Thanks.
>
> $ cat ./main.sh
> #!/usr/bin/env bash
> # vim: set noexpandtab tabstop=2:
>
> echo <(echo 1:$BASHPID>&2) <(echo 2:$BASHPID>&2)
> echo "$!"
> wait "$(($!-1))"
>
> $  ./main.sh
> 1:38520
> /dev/fd/63 /dev/fd/62
> 38521
> 2:38521
> ./main.sh: line 6: wait: pid 38520 is not a child of this shell
>
> --
> Regards,
> Peng
>
>


reply via email to

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