On Thu, Jun 23, 2005 at 04:56:01PM -0700, Brandon Evans wrote:
> Here is an example that may help
>
> control:
> # This returns 1 if there is a /home partation, 0 if not
> ret_home = ( ExecResult(/bin/sh -c "df -l | grep -E '^/dev' | awk '{print
> $NF}' | grep -c '^/home'"))
>
> classes:
> # Here I use strcmp to check if ret_home is a 1 or 0
> # if it is a 1, HomePart is defined
> HomePart = ( Strcmp("1","${ret_home}") )
What's the advantage of doing this, as opposed to this:
classes:
HomePart = ( ReturnsZero(/bin/sh -c "df -l | grep '^/dev' | awk '{print $NF}'
| grep -q '^/home$'") )
As far as I can see, that should do the same with less code. Plus, by
adding '$' to the end of the regex in the last grep, you avoid a false
positive on stuff like /home/a and /home/b (large sites often have to
split /home on multiple disks).
--
Knut Auvor Grythe
ITEA Systemdrift
_______________________________________________
Help-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cfengine