[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading from external command
From: |
Peng Yu |
Subject: |
Re: reading from external command |
Date: |
Wed, 30 Mar 2022 17:32:56 -0500 |
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