[Top][All Lists]

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

Re: 2.1.17 having issue with ExecResult() using pipelines

From: Chip Seraphine
Subject: Re: 2.1.17 having issue with ExecResult() using pipelines
Date: Fri, 11 Nov 2005 13:48:08 -0600
User-agent: Mozilla Thunderbird 1.0.5 (X11/20050711)

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:

 thisworks= ( ExecResult(/bin/sh -c 'command1 "quotedarg" | command2') )


 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.

reply via email to

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