Subject: Re: "for" behaviour in /bin/sh
To: Chet Ramey <chet@nike.ins.cwru.edu>
From: Charles M. Hannum <mycroft@mit.edu>
List: current-users
Date: 07/13/1998 20:15:27
> POSIX.2 says that an empty list following the `in' is a syntax error.

NOT!!

IEEE Std 1003.2-1992 (POSIX.2), section 3.9.4.2, says:

`First, the list of words following {in} shall be expanded to generate
a list of items.  Then, the variable {name} shall be set to each item,
in turn, and the {compound-list} executed each time.  If no items
result from the expansion, the {compound-list} shall not be executed.
...

{Exit status}: The exit status of a {for} command shall be the exit
status of the last command that executes.  If there are no items, the
exit status shall be zero.'