help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] pipe character at end of command ?


From: Andy Chu
Subject: Re: [Help-bash] pipe character at end of command ?
Date: Wed, 23 Nov 2016 11:24:16 -0800

> As for documentation, see "PROMPTING" in the bash man page.  It's
> another one of those things that's so common, and has been around for
> so long, that it may not even be spelled out explicitly, but the
> PROMPTING section at least mentions it.

FWIW it is in the POSIX grammar:

pipe_sequence    :                             command
                 | pipe_sequence '|' linebreak command


http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02

Although I'm not sure of the history, I'm pretty sure the grammar
hasn't changed much in a long time.  All shells I've tested (bash,
dash, busybox ash, mksh, zsh to some extent) are very POSIX compliant
in terms of their parsing -- the grammar matches reality.  It only
covers a small portion of the language, but shells seem to all agree
on that portion.

I just wrote a parser that handles almost all real bash scripts, and
documented some shell trivia I found along the way here:

http://www.oilshell.org/blog/

index by topic: http://www.oilshell.org/blog/2016/11/20.html

I was partially inspired by Chet Ramey's chapter on bash in the AOSA
book [1], where he mentions that yacc causes a bunch of problems.  My
parser is top-down like essentially all other parsers except bash (and
the old but recently open-sourced mwc-sh [2]):

http://www.aosabook.org/en/bash.html

https://github.com/roytam1/mwc-sh/blob/master/parse.y
https://en.wikipedia.org/wiki/Coherent_(operating_system)

Andy



reply via email to

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