I'm not sure I understand what you are trying to achieve

I think it would be :
"Has_ce_nic" expression => returnszero("/bin/grep \"ce\" 
/etc/path_to_inst >/dev/null 2>&1 ", "useshell");
if you want to match ce
or
"Has_ce_nic" expression => returnszero("/bin/grep '\"ce\"' 
/tmp/path_to_inst >/dev/null 2>&1 ", "useshell");
if you want to match "ce" (note the ' )

Regards

Nicolas CHARLES
Normation SAS - http://www.normation.com
44 rue Cauchy – 94110 ARCUEIL
+33 (0)1 83 62 26 96  - +33 (0)6 14 63 25 18


On 01/11/2010 20:07, JIM AMANATIDIS, BLOOMBERG/ 731 LEXIN wrote:
> Okay, this seems to break with the string being searched is wrapped in 
> quotes, regardless of how many "\" surround it to escape it:
>
>    classes:
>      "Has_ce_nic"     expression =>  returnszero("/bin/grep \\\"ce\\\" 
> /etc/path_to_inst>/dev/null 2>&1", "useshell");
>
> Note, if I use "noshell" and remove the /dev/null stuff, the expression 
> works. But that defeats the original point of trying to make this quiet.
>
> Thanks, Jim
>
>
>
> ----- Original Message -----
> From: no-re...@cfengine.com
> To: help-cfengine@cfengine.org
> At: 10/26 19:02:46
>
> Forum: Cfengine Help
> Subject: Re: how to redirect to /dev/null
> Author: joke
> Link to topic: https://cfengine.com/forum/read.php?3,18892,18897#msg-18897
>
> I think you should just enable the shell and do shell redirecting.
>
> classes:
> "Is_SOL10_U1" expression =>  returnszero("/bin/grep s10s_u1wos 
> /etc/release>/dev/null 2>&1", "useshell");
>
> Enabling the shell causes overhead though.
>
> Unfortunately cfengine prohibits using "exec /bin/grep ..." as command. This 
> would prevent forking a process and save some resources but cfengine requires 
> the input pattern to begin with a "/".
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to