Date: Mon, 06 Mar 2000 01:44:35 -0800 From: Doug Barton <Doug@gorean.org> To: Warner Losh <imp@village.org> Cc: Sheldon Hearn <sheldonh@uunet.co.za>, Max Khon <fjoe@iclub.nsu.ru>, hackers@FreeBSD.ORG Subject: Re: empty lists in for Message-ID: <38C37E03.A49AD802@gorean.org> References: <34889.952334114@axl.ops.uunet.co.za> <200003060932.CAA57921@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Warner Losh wrote: > > In message <34889.952334114@axl.ops.uunet.co.za> Sheldon Hearn writes: > : On Mon, 06 Mar 2000 00:59:39 PST, Doug Barton wrote: > : > : > for name [ in word ] > : > do > : > compound-list > : > done > : > > : > the "in word" is optional. Therefore: > : > : Hmmm, you're right. > : > : I must admit, though, that if the text is confusing enough to confuse > : me, it's not entirely clear (even if I'm not the hardest person in the > : world to confuse)! > > Are you sure that "word" here means one or more tokens, or zero or > more tokens. If it means zero or more tokens, then 'for i in ; do ' > is perfectly legal. You're not quoting what word means. > > The reason that I ask this is that I can't see why > for i in ; do > would be any different than > for i in $foo; do > when foo is empty. They are the same thing from at last my world view > of the shell. The context of the text (previously quoted) clearly expects that "word" be expanded. An expansion which evaluates to an empty set is different from a lack of "word" to be expanded at all. That's why "in word" is optional, but "word" isn't. IIRC, $name can be set outside of the expression, which would allow it to be acted on within the list. At the same time, I'd also like to see if POSIX has a clear definition of "word." Doug -- "Welcome to the desert of the real." - Laurence Fishburne as Morpheus, "The Matrix" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38C37E03.A49AD802>