bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PIPESTATUS differs from $? for compound command


From: Chet Ramey
Subject: Re: PIPESTATUS differs from $? for compound command
Date: Thu, 12 Dec 2024 11:24:42 -0500
User-agent: Mozilla Thunderbird

On 12/11/24 2:44 AM, Ulrich Müller wrote:

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.

In other words, this was a design choice?

Yes.


One problem is that error-checking by testing PIPESTATUS for all-zero
doesn't work after a construct like this (and similar for "case"):

If using PIPESTATUS doesn't work for your use case, use $? instead.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]