For your delectition I have arranged for a patch
ExecShellResult
which will work just like ExecResult but use a shell, so that your pipes
will work now. You can get it from the svn server right now. Snapshot in
a few mins
M
On Fri, 2005-11-11 at 15:24 -0500, nathan r. hruby wrote:
On Fri, 11 Nov 2005, Chip Seraphine wrote:
nathan r. hruby wrote:
On Fri, 11 Nov 2005, Martin, Jason H wrote:
If yada isn't in the normal path then that might be a problem; I don't
know what PATH will be set to when that happens. Good point.
Err.. right: here's the full real command:
CurrentLoad = ( ExecResult(/bin/sh -c "/bin/cat /proc/loadavg |
/bin/awk '{print $1}' | tr -d '\n'") )
What I'm seeing in 2.1.17 is that everything after "/bin/cat" simply
dissapears and thus no pipeline. eg, run a ps -ef while this is runnning
and the awk and tr are not being executed. The above works in 2.1.14.
I've had similar problems (starting in 2.1.16, I think). I've been able to
workaround it by switching the order of quote nesting; in other words:
Yeah, I see that now
http://groups.google.com/group/gnu.cfengine.help/browse_frm/thread/75f340262cc417d7/30b98b9f4d33df5b?q=Quotes+make+a+difference+in+2.1.16&rnum=1#30b98b9f4d33df5b
thisworks= ( ExecResult(/bin/sh -c 'command1 "quotedarg" | command2') )
but
thisnoworks= ( ExecResult(/bin/sh -c "command1 'quotedarg' | command2") )
In cases where I really neeed single quotes on the inside (as you do in your
awk call), I've generally just punted and written little shell scripts for
cfengine to call. I could probably kludge it with special variables, but it
gets nearly unreadable quickly.
Sigh. Neither are good solutions. I have a lot of these little pipelines,
all culled from the little shell scripts I'm trying to get rid of so it
looks like the kludgy special variable it is.. Which doesn't seem to work
either.
Oh hell.
-n
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/help-cfengine