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