help-bash
[Top][All Lists]
Advanced

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

Question about compound_list in bash grammar


From: crimson flame
Subject: Question about compound_list in bash grammar
Date: Wed, 9 Dec 2020 23:48:52 +0530

Hi,
Why does the following command not work on bash CLI?

*for i in {1..5}; do echo $i done*

In parse.y in bash source, compound_list is declared like this:






*compound_list:  list        |       newline_list list1
    {                          $$ = $2;                        }        ;*

This means that it could be a 'list' which is newline/; terminated or it
could be a newline_list list1.

Important to note that list1 is* *NOT* *necessarily terminated by a
newline/;* This means that it is not necessary that compound_list be
newline/; terminated*.

Now, the 'for' command is declared like this:

*FOR WORD newline_list IN word_list list_terminator newline_list DO
compound_list DONE*

The command I pasted at the beginning of this mail follows this format and
does not work. However, the following command works-

*for i in {1..5}; do echo $i; done*

Is newline/; termination necessary for a compound_list? How is it coming
out from the grammar?

Thanks,
-Sisir


reply via email to

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