m4-discuss
[Top][All Lists]
Advanced

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

confused by m4 esyscmd expansion ... how to 'escape' nested quotes?


From: OpenMacNews
Subject: confused by m4 esyscmd expansion ... how to 'escape' nested quotes?
Date: Fri, 05 Aug 2005 00:39:01 -0700

hi all,

i'm attempting to use m4 to expand/define my machine's IP address for use in apache's httpd.conf.

the cmd string:

% dig @my.ns.domain.com machine.domain.com | grep machine.domain.com | grep -v DiG | grep -v ";"machine.domain.com | awk '{print $5}'

works fine @ shell to pick out the IP address for machine.domain.com.

in httpd.conf.m4, i'd then hope to add:

        ...
define(`MY_IP_ADDR', `esyscmd(dig @my.ns.domain.com machine.domain.com | grep machine.domain.com | grep -v DiG | grep -v ";"machine.domain.com | awk '{print $5}')')
        ...
        <VirtualHost MY_IP_ADDR:80>
        ...

which, after:

        % m4 httpd.conf.m4 > httpd.conf

would expand to, in httpd.conf, e.g.:

        ...
        <VirtualHost 10.0.0.6:80>
        ...


unfortunately, processing the above results in a processing error of:

        NONE:0: m4: ERROR: EOF in argument list

which seems to be a result of improper escaping of the single- and double-quotes at the end of the m4 define, i.e.:


      ... ... ";"machine.domain.com | awk '{print $5}')')
                                          ^          ^ ^

QUESTION: how would i properly define/escape the esyscmd(arg)? i keep staring at the silly thing and am in 'quote catch-22' 8-}


thx,

richard




reply via email to

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