bug-bash
[Top][All Lists]
Advanced

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

Re: for builtin violates Single UNIX Specification


From: Chet Ramey
Subject: Re: for builtin violates Single UNIX Specification
Date: Tue, 6 Nov 2001 09:00:26 -0500

> The Single UNIX Specification, Version 2 (available at
> http://www.opengroup.org/onlinepubs/007908799/) says:
> 
> ------------------------------------------------------------------------------
> The format for the for loop is as follows:=20
> 
>      for name [ in word ... ]
>      do
>          compound-list
>      done
> 
> First, the list of words following in will be expanded to generate a list of
> items. Then, the variable name will be set to each item, in turn, and the
> compound-list executed each time. If no items result from the expansion, the
> compound-list will not be executed.
> ------------------------------------------------------------------------------
> 
> But
> 
>     bash-2.05$ for i in
>     bash: syntax error near unexpected token `in'
> 
> or
> 
>     bash-2.05$ for i in ; do :; done
>     bash: syntax error near unexpected token `;'

What are you talking about?  The bash behavior you demonstrate follows the
cited standard exactly.  If the `in' reserved word appears, it *must* be
followed by a non-empty word list.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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