help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] behavior of -o pipefail


From: Chet Ramey
Subject: Re: [Help-bash] behavior of -o pipefail
Date: Mon, 29 Oct 2018 15:58:23 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 10/29/18 3:54 PM, Greg Wooledge wrote:
> On Mon, Oct 29, 2018 at 08:49:32PM +0100, Christof Warlich wrote:
>> With piplines being made up of such well-behaving filters, it would
>> still be beneficial to see the first error instead of the last one. Can
>> we agree with that?
> 
> If you care about that, just use the PIPESTATUS array variable instead of
> pipefail.  Pipefail is only intended to report "something bad happened",
> not to help you pinpoint exactly which bad thing happened to whom.  It's
> a sledgehammer, not a sewing needle.

You're not wrong. `set -o pipefail' is intended to fill the functionality
gap caused by $? only using the exit status of the last element of the
pipeline. If you want more, there are tools available.

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



reply via email to

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