help-cfengine
[Top][All Lists]
Advanced

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

Re: quoting and parentheses in ExecResult?


From: Steve Wray
Subject: Re: quoting and parentheses in ExecResult?
Date: Thu, 18 Aug 2005 08:35:17 +1200
User-agent: Mozilla Thunderbird 0.9 (X11/20041103)

Knut Auvor Grythe wrote:
> On Wed, Aug 17, 2005 at 07:56:58AM +0200, Mark Burgess wrote:
> 
>>>Well, when I say *exactly* I mean:
>>>
>>>
>>>>$(dollar)/&.conf/g\"")>
>>
>>But this does not have balanced quotes or parentheses, so it doesn't
>>make much sense to me. You can't have a semi-quoted exoression
>>in any language..
> 
> 
> The problem is, as far as I can see, this:
> 
> You have your weird oneliner with parentheses in it:
> 
>   someresult = ( ExecResult(/bin/sh "/bin/echo baz|/bin/sed -e 
> \"s/^\(.*\)$/&.conf/g\"") )
> 
> cfengine starts parsing it, and finds "ExecResult(". Okay, it thinks,
> It'll Have to find the matching parenthesis. So it scans through the
> string until it finds one. It finds one in the middle of the oneliner,
> about here:

I am thinking that this could also explain why its important to use
curly braces instead of parentheses when you want to use cfengine
variables in ExecResults.

For example, given:
sh = ( "/bin/sh -c" )

this doesn't work:
someresult = ( ExecResult($(sh) "/bin/echo baz") )

but this does:
someresult = ( ExecResult(${sh} "/bin/echo baz") )

This has been noted on the mailing list some time ago.

-- 
"Politics is the art of looking for trouble, finding it, misdiagnosing
it, and then misapplying the wrong remedies." - Groucho Marx

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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