[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading from external command
From: |
Jesse Hathaway |
Subject: |
Re: reading from external command |
Date: |
Tue, 29 Mar 2022 14:02:53 -0500 |
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.
- reading from external command, Peng Yu, 2022/03/29
- Re: reading from external command,
Jesse Hathaway <=
- 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