On Mon, Oct 23, 2006 at 02:15:58PM +0200, Bruno Haible wrote: > Hi, > > All versions of bash grok > for f in $VAR; do ...; done > where VAR is an empty shell variable. But > for f in $(VAR); do ...; done > where $(VAR) is an empty Makefile variable, leads to a syntax error with > bash 2.00..2.05. The solution is ugly... > > > 2006-10-21 Bruno Haible <[EMAIL PROTECTED]> > > * gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am): > Change mostlyclean-local rule to avoid sh syntax error from bash > versions 2.00..2.05 when $(MOSTLYCLEANDIRS) is empty.
I've always found this to be a more readable alternative: > echo "mostlyclean-local: mostlyclean-generic" > ! echo " @MOSTLYCLEANDIRS=\"\$(MOSTLYCLEANDIRS)\" \\" > ! echo " test -z \"\$\$MOSTLYCLEANDIRS\" || \\" > ! echo " for dir in \$\$MOSTLYCLEANDIRS; do \\" > ! echo " if test -d \$\$dir; then \\" > ! echo " echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\" > ! echo " fi; \\" > ! echo " done" (Of course there are different failure modes for directories containing special characters for both alternatives.) -- Daniel Jacobowitz CodeSourcery