Subject: Re: "for" behaviour in /bin/sh
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 07/13/1998 10:02:14
> [...] for what its worth NetBSD's manual says:

>            for variable in word...
>            do   list
>            done

> and while "word" can be an empty $*, or $@, that's not the same as
> leaving out the token altogether.

An empty $* or $@ *should* be the same as having nothing there...and
indeed in a test I just did:

[Callisto] 21> sh
# echo $# 
0
# for i in $*; do echo $i; done 
# for i in; do echo $i; done
# 

This sh binary is dated Jan 21, and the most recent date in the
$NetBSD$ lines output by "strings - /bin/sh | egrep NetBSD" is
1997/11/13 (histedit.c 1.16.2.1).  If anyone cares about the revision
number of any particular file, I can check for it.

> But again, I'm sure I've seen "word" omitted but like:

> 	for i in
> 	do
> 		...
> 	done

Sure you're not thinking of this?  (Note the lack of "in".)

	for i
	do
		...
	done

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B