help-cfengine
[Top][All Lists]
Advanced

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

ExecResult not working as expected


From: Kurt Lieber
Subject: ExecResult not working as expected
Date: Fri, 26 Mar 2004 12:33:13 -0500
User-agent: Mutt/1.5.5.1i

At least, it's not working as I'd expect it to.  I need to parse out some
cpu information for a motd banner.  I'm trying to use ExecResult to set
this to a variable.  So far, I've tried three different commands:

cpu_info = ( ExecResult("/bin/cat /proc/cpuinfo | /bin/grep model\ name | 
/bin/cut -d : -f 2 | /bin/uniq -c | /bin/sed 
's/\([0-9]\{1\}\)[[:space:]]\+\(.*\)/\1 x \2/'") )
cpu_info = ( ExecResult($(mirror_scripts)/rsync-cpuinfo.sh) )
cpu_info = ( ExecResult(/full/path/to/scripts/rsync-cpuinfo.sh) )

Of those, only the last one works.  (rsync-cpuinfo.sh only contains a shebang 
line and the above long shell command)

The first two simply output the value of cpu_info as a literal string.  So, 
instead of printing "1 x AMD Athlon(tm) MP 2400+: which is what I'd expect, I 
get:

ExecResult(/full/path/to/scripts/rsync-cpuinfo.sh)

I also tried the first command with and without double and single quotes 
surrounding it.

What am I doing wrong?

--kurt

Attachment: pgpLKw8psg5Ux.pgp
Description: PGP signature


reply via email to

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