[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PIPESTATUS differs from $? for compound command
From: |
microsuxxor |
Subject: |
Re: PIPESTATUS differs from $? for compound command |
Date: |
Tue, 10 Dec 2024 04:33:00 +0100 |
the | true is the.last pipe
while witbout , its.one cmd less
the | true is $pipestatus[1][*]
On Tue, Dec 10, 2024, 4:31 AM Dale R. Worley <worley@alum.mit.edu> wrote:
> Andreas Schwab <schwab@linux-m68k.org> writes:
> >> But the PIPESTATUS refers to the 'false' pipeline:
> >> $ if false; then :; fi; echo ${PIPESTATUS[*]}
> >> 1
> >
> > $ if false; then :; fi | true; echo ${PIPESTATUS[*]}
> > 0 0
> >
> > Why is that not `1 0'? After all, the last executed commands as part of
> > the pipeline (by your reasoning) are `false' and `true'.
>
> It looks complicated:
>
> $ if false; then :; fi | true; echo ${PIPESTATUS[*]}
> 0 0
> $ if false; then :; fi | true; echo $?
> 0
> $ if false; then :; fi ; echo ${PIPESTATUS[*]}
> 1
> $ if false; then :; fi ; echo $?
> 0
>
> I'm sure there's an explanation, but I'm not feeling up to spelunking
> through the documentation enough to figure it out.
>
> Dale
>
>
- PIPESTATUS differs from $? for compound command, Ulrich Müller, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command, microsuxxor, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command, Mike Jonkmans, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command, Andreas Schwab, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command, Mike Jonkmans, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command, Andreas Schwab, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command, Dale R. Worley, 2024/12/09
- Re: PIPESTATUS differs from $? for compound command,
microsuxxor <=
- Re: PIPESTATUS differs from $? for compound command, Dale R. Worley, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Mike Jonkmans, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Andreas Schwab, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, microsuxxor, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Ulrich Müller, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, microsuxxor, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Mike Jonkmans, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Phi Debian, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Chet Ramey, 2024/12/10
- Re: PIPESTATUS differs from $? for compound command, Mike Jonkmans, 2024/12/11