Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Short loops?
- X-seq: zsh-workers 2932
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: <hzoli@xxxxxxxxxxxx> (Zoltan T. Hidvegi)
- Subject: Re: Short loops?
- Date: Wed, 26 Feb 1997 13:14:10 -0800
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <hzoli@xxxxxxxxxxxx> (Zoltan T. Hidvegi) "Re: Short loops?" (Feb 26, 2:27pm)
- References: <9702261927.AA16863@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Feb 26, 2:27pm, (Zoltan T. Hidvegi) wrote:
> Subject: Re: Short loops?
>
> Bart Schaefer wrote:
> > misleading. The /bin/sh manual can get away with `while LIST do LIST done'
> > because in /bin/sh the semicolon or newline at the end of a LIST is never
> > optional (the definition of LIST *includes* the trailing separator in the
> > /bin/sh manuals).
>
> Then the /bin/sh manual is wrong. if (true) then (echo foo) fi works fine
> in sh.
Hmm. Yup, you're right; I dug up my hardcopy of the 4.2 BSD `sh' man page.
I withdraw that objection.
Nevertheless, the point is that the "optional" terminator mentioned in the
definition of a "list" is not optional in the short forms. It *must* be
left out.
> > The doc could define a CLOSED construct to be any of (( )) [[ ]] ( ) { },
> > and define a CLOSEDLIST to be a LIST ending with a CLOSED but that is NOT
> > followed by the optional separator.
>
> Yes, but that would make the manual quite verbose repeating the same thing
> many times.
Why would that cause it to repeat itself more than it already does?
However, if something close to this text:
} If you interpret LIST as the longest string which is synactically a list
} than it is correct. In while true ; { echo foo } the longest possible list
} is true ; { echo foo }.
were added to the section on alternate forms, that would probably clarify
enough. Maybe also move the reserved words section above the alternate
forms, but that helps only when reading sequentially through the info.
Peter, how about adding something about this to the FAQ as well?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
Messages sorted by:
Reverse Date,
Date,
Thread,
Author