autoconf
[Top][All Lists]
Advanced

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

Re: automatic setting of srcdir


From: Akim Demaille
Subject: Re: automatic setting of srcdir
Date: 07 Nov 2000 18:22:22 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

| On Tue, Nov 07, 2000 at 06:09:45PM +0100, Akim Demaille wrote:
| : absolute="`cd "$relative" && pwd`"
| : 
| : is not portable, and nor is
| : 
| : absolute="`cd \"$relative\" && pwd`"
| 
| That the first line is not portable comes as no surprise.
| That the second one isn't - I find obscene...

Yep, sorry :(

autoconf.texi
>    Contrary to a persistent urban legend, the Bourne shell does not
> systematically split variables and backquoted expressions, in
> particular, the following code:
> 
>      case "$given_srcdir" in
>      .)  top_srcdir="`echo "$dots" | sed 's,/$,,'`"
>      *)  top_srcdir="$dots$given_srcdir" ;;
>      esac
> 
> is more readable with the right-hand side of the assignments, and the
> argument of `case' left without quotes:
> 
>      case $given_srcdir in
>      .)  top_srcdir=`echo "$dots" | sed 's,/$,,'`
>      *)  top_srcdir=$dots$given_srcdir ;;
>      esac
> 
> and in fact it is even _more_ portable: in the first case of the first
> attempt, the computation of `top_srcdir' is not portable, since not all
> the shells understand properly `"`... "foo"... `"'.  Worse yet, not all
> the shells understand `"`... \"foo\"... `"' the same way: there is just
> no portable way to use double-quoted strings inside double-quoted
> backquoted expressions (Pfew!).


| : You don't have to quote rhs of assignments, nor the case argument
| : 
| : case `echo there are spaces in there` in
| :   "there are"*there ) echo OK;;
| :   *) echo 'Niah???';;
| : esac
| 
| You probably mean that you don't have to quote rhs and the case
| argument as long as they are expansions from some construct that
| doesn't need quoting.  You can't do the following:
| 
| absolute=C:\\Windows\\Program Files
| 
| case there are spaces in there in

Yes, of course.



reply via email to

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