[Top][All Lists]

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

Re: Autoconf Transforms

From: Eric Blake
Subject: Re: Autoconf Transforms
Date: Wed, 15 Oct 2008 19:20:18 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080914 Thunderbird/ Mnenhy/

Hash: SHA1

According to Ralf Wildenhues on 10/15/2008 12:43 PM:
>> e.g., regex classes, where 's/[^0-9]//' becomes 's/^0-9//' unless one
>> doubles the square braces like so 's/[[^0-9]]//' in which case one of
>> each pair is stripped away to get the desired form in the resulting
>> 'configure' file.  But that may not be the correct way to handle it.
> It's a valid way.  You can move the quotes outward:
> $some_normal_code
> [ $double_quoted_code
>   ..
>   sed 's/[^0-9]//' ...
>   $more_double_quoted_code
> ]

In fact, it is considered good style to move the quotes outward, as it
makes it easier to copy and paste blocks of code.

>> I guess the manual is trying to tell me that implicitly by discussing
>> the m4 processor parsing rules, but I haven't yet found an explicit
>> warning to that effect about use of shell commands (except the
>> warnings about portable shell programming and recomended non-use of
>> the negated character class form).

give the best summary.  Basically, use [foo] as a macro argument if you
want foo to be reparsed as a macro name, and [[foo]] as a macro argument
if you want it treated as literal text.  In your case, you want the regex
to be literal text, so

  case $foo in
   [0-9]*) ;;

is the right quoting.  If you have improvements for the wording in the
manual, please let us know!

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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