On Fri, Oct 9, 2009 at 1:24 PM, Dave B <dave...@gmx.com> wrote:

> On Friday 09 October 2009, Pierre Gaston wrote:
>
> > > Repeat-By:
> > >        printf '%s\n%s\n' foo bar | while read NAME;
> > >        echo NAME=$NAME
> > >        do
> > >            echo blah
> > >        done
> >
> > Not sure what is the incorrect syntax, and it seems normal that it goes
> > into an infinite loop since echo is always true.
>
> Well, it seems to me (and as stated in the bug report) that a "do" should
> follow the "while read NAME;".
>
>
the while syntax is like this:
"while list; do list; done"
and the manual says "A sequence of one or more newlines may appear in a
list  instead  of  a semicolon to delimit commands."
so you can have:

while command
command
do

(the ; in the definition is probably there to keep the definition on one
line, you can replace the ; in all the other definitions by a newline like:
if command
then

This also works the same way in the other shells. For me it's not a bug.

Reply via email to