[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading from external command
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: reading from external command |
Date: |
Thu, 31 Mar 2022 00:37:29 +0200 |
try, a second wait or wait -n
i suppose it may return the second return code
On Thu, Mar 31, 2022 at 12:33 AM Peng Yu <pengyu.ut@gmail.com> wrote:
> I am not sure how wait for "$!" would work robustly.
>
> In the following example, it can not get the error in the input.
>
> $ cat ./main.sh
> #!/usr/bin/env bash
> # vim: set noexpandtab tabstop=2:
>
> while read -r x; do
> echo <(exit 42)
> done < <(
> builtin printf '%s\n' a b c
> false
> )
> wait "$!"
> echo "$?"
> $ ./main.sh
> /dev/fd/63
> /dev/fd/63
> /dev/fd/63
> 42
>
> On 3/30/22, Chet Ramey <chet.ramey@case.edu> wrote:
> > On 3/30/22 1:44 PM, Peng Yu wrote:
> >> I don't get what you mean. Could you elaborate on it? Thanks.
> >
> > The PID of the most recent process substitution is available in $!, like
> > any other asynchronous process. You can wait on that.
> >
> >
> > --
> > ``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/
> >
>
>
> --
> Regards,
> Peng
>
>
- reading from external command, Peng Yu, 2022/03/29
- Re: reading from external command, Lawrence Velázquez, 2022/03/30
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/30
- Re: reading from external command, Peng Yu, 2022/03/30
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/30
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/31
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/31
- Re: reading from external command, Chet Ramey, 2022/03/31
- Re: reading from external command, Peng Yu, 2022/03/31
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/31