bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnulib-tool: fix for platforms with bash 2.x


From: Daniel Jacobowitz
Subject: Re: gnulib-tool: fix for platforms with bash 2.x
Date: Mon, 23 Oct 2006 10:44:17 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

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  <address@hidden>
> 
>       * 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




reply via email to

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