[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: awk comands inside m4 macros
From: |
Keith Marshall |
Subject: |
Re: awk comands inside m4 macros |
Date: |
Sat, 16 Jul 2005 13:54:11 +0100 |
On Saturday 16 July 2005 12:24 pm, Chris Coleman wrote:
> WANT_BOOST_MAJOR=`echo $boost_min_version | $AWK -F. '{print $1}'`
> echo $WANT_BOOST_MAJOR
>
> $1 => 1.320
> $2 => 1.32.0
> $3 => gives the below error:
> awk: syntax error at source line 1
> context is
> {print >>> { <<<
> awk: illegal statement at source line 1
> awk: syntax error at source line 2
>
> What have I missed when transfering a command from the comand line, into
> my configure scripts like this?
WANT_BOOST_MAJOR=`echo $boost_min_version | $AWK -F. '{print $[1]}'`
m4 sees $1 as a macro argument, and tries to expand it -- you need to
separate the `$' and the `1', with quoting, to get `$1' passed through to
configure unscathed. Same applies to any of `$0'..`$9'.
Alternatively, if depth of quoting becomes an issue, you may need the
address@hidden|@'
quadrigraph, in place of the `$'.
HTH.
Keith.