On 12/9/24 12:21 PM, Ulrich Müller wrote:
Bash Version: 5.2 Patch Level: 37 Release Status: releaseDescription: For a compound command like "if" or "while" and with an unsuccessful test, the last element of PIPESTATUS is not the return status of the compound but that of the test command. For example, "if false; then :; fi" returns 0 but ${PIPESTATUS[0]} is 1.
Compound commands don't generally set PIPESTATUS. Multi-element pipelines
(the original purpose, because otherwise why bother), simple commands
(single-element pipelines) including shell builtins, and compound commands
that resemble simple commands (`[[', `((') set it.
Yes, you can make the case that compound commands are pipelines, and,
according to the grammar, they are, but their status is always available
in $?, and they never have more than one status value.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
