[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: |
Tue, 29 Mar 2022 14:07:57 -0500 |
On 3/29/22, Jesse Hathaway <jesse@mbuki-mvuki.org> wrote:
> On Tue, Mar 29, 2022 at 1:36 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>> Is there a more elegant and efficient way to solve this problem
>> without having to use a tempfile?
>
> lastpipe would allow you use to use PIPESTATUS:
>
> shopt -s lastpipe
> {
> printf '%s\n' a b c
> exit 1
> } |
> while read -r x; do
> results+=("$x")
> done
> declare -p PIPESTATUS
> declare -p results
>
> but, I don't believe there is anyway for the inner loop to
> know about errors from the previous command in the
> pipeline, unless you resort to touching files or use some
> other communication mechanism.
Could shared memory be a more efficient underlying mechanism
supporting interprocess bash variable communication than using files?
--
Regards,
Peng
- reading from external command, Peng Yu, 2022/03/29
- Re: reading from external command, Jesse Hathaway, 2022/03/29
- Re: reading from external command,
Peng Yu <=
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/29
- Re: reading from external command, Chet Ramey, 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, Chet Ramey, 2022/03/30
- Re: reading from external command, Peng Yu, 2022/03/30
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/30
- Message not available
- Message not available
- Re: reading from external command, Alex fxmbsw7 Ratchev, 2022/03/30
- Re: reading from external command, Lawrence Velázquez, 2022/03/30