autoconf-patches
[Top][All Lists]
Advanced

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

sed: portability of $ in pattern (Was: Re: [PATCH] Speedup creation of c


From: Alexandre Duret-Lutz
Subject: sed: portability of $ in pattern (Was: Re: [PATCH] Speedup creation of configure.lineno)
Date: Thu, 08 Jan 2004 00:04:30 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

>>> "Paul" == Paul Eggert <address@hidden> writes:

[...]
 >> +     /$LINENO/=' <$as_myself |

 Paul> For portability the $ needs to be escaped from 'sed' by
 Paul> surrounding it with square brackets, which in turn need
 Paul> to be doubled, thus: [[$]]LINENO.
[...]

Any idea where it does not work?  I think this would be nice to
document.  

That construct seems to have slipped in another place of
autoconf (and I've seen it in automake too).

Autoconf outputs this:

for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
  # 1. Remove the extension, and $U if already installed.
  ac_i=`echo "$ac_i" |
         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`

Inside back-quotes, \ is active only before $ and `,
so the command actually run in the sub-shell is 

  echo "$ac_i" | sed 's/$U\././;s/\.o$//;s/\.obj$//'

Note the $U which ought to be a [$]U.
-- 
Alexandre Duret-Lutz





reply via email to

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