[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug report for ExecResult() function
From: |
Kurt Lieber |
Subject: |
bug report for ExecResult() function |
Date: |
Sun, 28 Mar 2004 08:32:21 -0500 |
User-agent: |
Mutt/1.5.5.1i |
Please see this thread for additional information and context:
http://mail.gnu.org/archive/html/help-cfengine/2004-03/msg00119.html
Short version:
ExecResult() does not handle complicated shell commands very well,
especially those with pipes and quotes in them. This does not work, for
example:
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/'") )
(also tried the same command except without the surrounding "")
cfagent complains about parsing problems:
eagle inputs # cfagent -f ./cf.rsync-mirror
cf:cfengine::./cf.rsync-mirror:30: ExecResult(/command) must specify an
absolute path
cfengine::./cf.rsync-mirror:30: Warning: Redefinition of macro
cpu_info=[[:space:]]\+\(.*\)/\1 (or perhaps missing quote)
cfengine::./cf.rsync-mirror:30: Warning: Redefinition of macro cpu_info=x (or
perhaps missing quote)
cfengine::./cf.rsync-mirror:30: Warning: Redefinition of macro cpu_info=\2/'")
(or perhaps missing quote)
Placing that exact line into a shell script and then using:
cpu_info = ( ExecResult(/full/path/to/scripts/rsync-cpuinfo.sh) )
does work as expected. This is less than desirable, however, as it means I
have to manage twice as many files.
--kurt
pgpQM6Vh4eMCC.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug report for ExecResult() function,
Kurt Lieber <=