On Tue, 2006-03-21 at 10:10 -0500, Brian E. Seppanen wrote:
> I have the following code
>
> classes:
> host_groupa::
> usera = ( ReturnsZero(/usr/bin/getent passwd usera) )
>
> So what that would do is evaluate a class usera if /usr/bin/getent passwd
> usera returns 0 if that user exists on the host. The disadvantage of
> this is that getent will provide output, which I don't want. I'm only
> interested in the return code. I want any of the output to go to
> /dev/null. So that is the first question. how can I take output from
> the command passed to ReturnsZero and send it to /dev/null?
How about
usera = ( ReturnsZero(/bin/sh -c ${quote}/usr/bin/getent passwd usera
>/dev/null${quote}) )
or wrap up getent in a script, which you pass to ReturnsZero instead,
and let it dispose of the output.
Jim
_______________________________________________
Help-cfengine mailing list
[email protected]
http://cfengine.org/mailman/listinfo/help-cfengine