[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: nathan r. hruby
Subject: Re: 2.1.17 having issue with ExecResult() using pipelines
Date: Fri, 11 Nov 2005 15:24:29 -0500 (EST)

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

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.

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

Oh hell.

nathan hruby <address@hidden>
uga enterprise information technology services
production systems support

reply via email to

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