bug-bash
[Top][All Lists]
Advanced

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

Re: null word list in for loops in bash-2.05.8 not allowed


From: Paul Jarc
Subject: Re: null word list in for loops in bash-2.05.8 not allowed
Date: Sun, 18 Nov 2001 01:59:16 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7 (i386-redhat-linux-gnu)

cpg@rocketmail.com wrote:
>               bash$ for i in ; do echo hi; done
>               bash: syntax error near unexpected token `;'

>From the 2.05a announcement:
o `for' loops now allow empty word lists after the `in' reserved word

Of course, portable scripts can't rely on this being supported.

>       the problem is that a makefile we have issues this loop:
>
>               for i in $(SOMETHING); do \
>                       install $$i ..... ; \
>               done

Assuming SOMETHING doesn't contain single quotes:
var='$(SOMETHING)'; for i in $var; do ...; done

>       but some times, $(SOMETHING) expands to nothing at all in the
>       makefile and fails the compilation process with the syntax
>       error mentioned above. i think what is going on is that it is
>       passed down on the shell in the form with nothing in between
>       the 'in' and the ';' and therefore we get the failure.

Right.


paul



reply via email to

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