[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] difference of $? and ${PIPESTATUS[0]}
From: |
Oğuz |
Subject: |
Re: [Help-bash] difference of $? and ${PIPESTATUS[0]} |
Date: |
Mon, 22 Apr 2024 10:56:03 +0300 |
On Mon, Apr 22, 2024 at 10:24 AM Kerin Millar <kfm@plushkava.net> wrote:
> I cannot find anything in the manual that concretely explains why bash
> behaves as it does in this instance.
Me neither, but the current behavior is useful. Take `while false |
false; do :; done' for example, if bash reported the status of the
while command in PIPESTATUS you couldn't tell which part of your
condition failed. This isn't reliable when the lastpipe shell option
is in effect and you have `some command | break' in your loop body but
I've never seen anything like that in a real shell script.