help-bash
[Top][All Lists]
Advanced

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

Re: Not to set PIPESTATUS unless necessary


From: Chet Ramey
Subject: Re: Not to set PIPESTATUS unless necessary
Date: Thu, 9 May 2024 11:08:33 -0400
User-agent: Mozilla Thunderbird

On 5/8/24 9:57 PM, Peng Yu wrote:
Hi,

true | true
false
echo ${PIPESTATUS[@]}

In the above commands, echo will print 1. But such information is also
available in $?. Therefore, I think it is unnecessary to set
PIPESTATUS after false. It is better to preserve its value until it is
really necessary. Otherwise, users will have to preserve PIPESTATUS
after running true | true. This will result in more code to write.

So your request is not to set PIPESTATUS after simple commands? I don't
think an option to do this would be useful.

--
``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]