From owner-freebsd-hackers Sun Mar 5 23:41:26 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from gilgamesch.bik-gmbh.de (T1-Hansenet.BIK-GmbH.de [192.76.134.246]) by hub.freebsd.org (Postfix) with ESMTP id 8890237BC9E for ; Sun, 5 Mar 2000 23:41:19 -0800 (PST) (envelope-from cracauer@gilgamesch.bik-gmbh.de) Received: (from cracauer@localhost) by gilgamesch.bik-gmbh.de (8.9.3/8.7.3) id IAA36573; Mon, 6 Mar 2000 08:40:31 +0100 (MET) Date: Mon, 6 Mar 2000 08:40:31 +0100 From: Martin Cracauer To: John Polstra Cc: Doug@gorean.org, hackers@FreeBSD.ORG, fjoe@iclub.nsu.ru Subject: Re: empty lists in for Message-ID: <20000306084031.A35426@cons.org> References: <57223.952177003@axl.ops.uunet.co.za> <20000305093539F.jhix@mindspring.com> <38C2B805.EA899C32@gorean.org> <200003060430.UAA85900@vashon.polstra.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <200003060430.UAA85900@vashon.polstra.com>; from jdp@polstra.com on Sun, Mar 05, 2000 at 08:30:18PM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In <200003060430.UAA85900@vashon.polstra.com>, John Polstra wrote: > In article <38C2B805.EA899C32@gorean.org>, > Doug Barton wrote: > > > > Given that Bash in both standard and POSIX mode complains about 'for i > > in ; do echo $i; done', I would say that it's not POSIX compatible. What > > could/does depend on this behavior "working?" > > It works for the realistic cases that might actually be useful. E.g.,: > > x= > for i in $x; do > echo $i > done > > works fine. I don't think it matters very much that the pathological > case "for i in ; ..." doesn't work. I just checked POSIX 1003.2. for name [ in word ] do compound-list done "First, the list of words following 'in' shall be expanded to generate a list of items." [...] "If no items result from the expansion, the compound-list shall not be executed." is not a word at all, so it can't be expanded, so I think bash is corrent to complain about a syntax error. It is clear, though, that your (John) example "variable expansion to nothing" is not an error and both shells do it right. To the original poster, it would have been useful to submit this as a bug report or at least choose a subject line that indicates that you're talking about the shell. I recognized the thread only when my name was written and missed the beginning. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer http://www.cons.org/cracauer/ BSD User Group Hamburg, Germany http://www.bsdhh.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message