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: Koichi Murase
Subject: Re: Not to set PIPESTATUS unless necessary
Date: Sun, 19 May 2024 08:19:16 +0900

2024年5月18日(土) 22:57 Peng Yu <pengyu.ut@gmail.com>:
> On Sat, May 18, 2024 at 5:21 AM Andreas Kähäri <andreas.kahari@abc.se> wrote:
> > You would also need to take the POSIX standard's definiton of a pipeline
> > into account, which I belive would trumph any dictionary's definition
> > when it comes to implementing a Unix shell:
> >
> >         A pipeline is a sequence of one or more commands separated by
> >         the control operator '|'.   [1]
> >
> > This is more or less the same as what you found in the bash manual,
> > except for the extension that bash provides with |&
>
> In that case, the POSIX is also defective.

It's not a language defect. POSIX *intentionally* includes a single
command in the category of the pipeline as is clear from the formal
grammar provided by POSIX, which Andreas has also quoted.

> It is an impossibility that
> one command is separated by a control operator.

We typically describe it in such a way even when it contains the case
of a single element without any separator. A CSV (comma-separated
values) file can contain a line of a single element without a command.
HISTCONTROL is described in Bash Reference Manual as a
"colon-separated list of values", but this includes a single value
without any separator. The mathematical terminology `polynomial'
includes a single term, e.g. x^2, even though it's not `poly' (i.e.
many). There are many examples. The reason that they contain the case
of a single element is because it is useful that way.



reply via email to

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