Try using grep -q, it is much easier than redirecting

On Nov 1, 2010, at 3:07 PM, 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