Re: PIPESTATUS differs from $? for compound command
From:
Andreas Schwab
Subject:
Re: PIPESTATUS differs from $? for compound command
Date:
Mon, 09 Dec 2024 21:20:54 +0100
User-agent:
Gnus/5.13 (Gnus v5.13)
On Dez 09 2024, Mike Jonkmans wrote:
> So, with 'if false; then :; fi', the whole if has 0 as status, due to #1.
> The last pipeline is the 'false' command. So $PIPESTATUS = 1.
Why is `if false; then :; fi' not a pipeline? It is a command, and the
components of a pipeline are commands.
> Both other examples, e.g. 'if false; then :; fi | true',
> are, for PIPESTATUS purposes, equivalent to: 'true | true'.
Why is `if false; then :; fi' not equivalent to `true' above?
--
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."