help-cfengine
[Top][All Lists]
Advanced

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

RE: Escape {} in shellcommnads?


From: Josh Hurd
Subject: RE: Escape {} in shellcommnads?
Date: Fri, 10 Feb 2006 14:11:08 -0800

I was able to solve this problem with the following:
control:
        openBrace = ( "{" )
        closeBrace = ( "}" )
shellcommand:
        "/bin/ps axo \"stime,pid,command\" | /bin/awk ' ${openBrace} print $2 ; ${closeBrace} ' "
 
not sure if this is the most graceful method but it works!
 
Josh


From: Josh Hurd
Sent: Friday, February 10, 2006 1:30 PM
To: help-cfengine@gnu.org
Subject: Escape {} in shellcommnads?

I am trying to run a shellcommand that includes a call to awk.  Awk requires the use of braces but CFE treats tham as variable substitutuions.  I have tried escaping them with \ with no success.  I've tried using single quotes and double quotes.

Here is a sample:
"/bin/ps axo \"stime,pid,command\" |  /bin/awk ' {print $2 ;} ' "

The error returned is:
Incomplete variable syntax or bracket mismatch

Does anyone know how to pull this off?  I don't want to deploy a one line shell script to all my clients.

Thanks!
Josh


reply via email to

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