On 2/22/21 8:11 AM, Mike Jonkmans wrote:
Hi, It seems some things are missing in the bash manual. Notably definition of command and placements of coproc- and function-definition. The section 'SHELL GRAMMAR' describes: - simple-command - pipeline - list - compound-command - coproc - function-definition
These are basically the `command' productions from the grammar. The exception is `list', and it's there because it would be strange for the reader if it were presented before simple commands and pipelines, which users are more likely to encounter, even though a complete command is technically a list.
Simplified, a pipeline is: [ ! ] command1 [ | command2 ] A list is a sequence of pipelines separated by ;, &, &&, or || and optionally terminated by ;, & or NL. Within the list description, the and-list and or-list are described as: and-list: command1 && command2 or-list: command1 || command2 Though the text says that and/or-lists are sequences of pipelines (separated by && or ||).
`command1' and `command2' are meta-notation, not a grammar production.
That is slightly inconsistent.
Not really.
A pipeline can be reduced to a command.
In a sense, yes, depending on your definition of `command'.
In that case, the and/or list should read: and-list: pipeline1 && pipeline2 or-list: pipeline1 || pipeline2
No, it really shouldn't. The bash grammar is a little messier than that POSIX grammar in https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02 but it's basically the same. Where are you trying to go with this? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/