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: microsuxxor
Subject: Re: PIPESTATUS differs from $? for compound command
Date: Tue, 10 Dec 2024 09:32:00 +0100

maybe internal cmds dont statisfy it a pipestatus worthy

On Tue, Dec 10, 2024, 9:29 AM Ulrich Müller <ulm@gentoo.org> wrote:

> >>>>> On Mon, 09 Dec 2024, Mike Jonkmans wrote:
>
> >> Why is `if false; then :; fi' not a pipeline?  It is a command, and the
> >> components of a pipeline are commands.
>
> > It is a pipeline indeed, but not the last (doc says:
> most-recently-executed).
> > The last is the 'false' simple command/pipeline.
>
> Then what about these?
>
> $ true; case a in esac
> $ echo "ret = $?, status = ${PIPESTATUS[*]}"
> ret = 0, status = 0
>
> $ false; case a in esac
> $ echo "ret = $?, status = ${PIPESTATUS[*]}"
> ret = 0, status = 1
>
> "case a in esac" is a one-command pipeline, and certainly it is executed
> after "false". So it should qualify as "the most-recently-executed
> foreground pipeline (which may contain only a single command)".
>
>


reply via email to

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