Re: PIPESTATUS differs from $? for compound command
From:
Andreas Schwab
Subject:
Re: PIPESTATUS differs from $? for compound command
Date:
Mon, 09 Dec 2024 23:33:02 +0100
User-agent:
Gnus/5.13 (Gnus v5.13)
On Dez 09 2024, Mike Jonkmans wrote:
> But the PIPESTATUS refers to the 'false' pipeline:
> $ if false; then :; fi; echo ${PIPESTATUS[*]}
> 1
$ if false; then :; fi | true; echo ${PIPESTATUS[*]}
0 0
Why is that not `1 0'? After all, the last executed commands as part of
the pipeline (by your reasoning) are `false' and `true'.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."