[c3-users] cexce question

Thomas Naughton naughtont at ornl.gov
Thu Jan 2 13:34:57 EST 2014


Hi,

Generally when using a pipelined command like this, you'll want to enclose
the entire string in a single quote to avoid having the local shell expand
pieces of the string.   However, when there are problems or complicated
shell escaping the easiest method is to just create a tmp script file and
run that:

      # Print username for my accounts (naughton) on cluster
     tjn at node0:$ cat tmp.sh
     cat /etc/passwd | grep -i naughton | awk -F: '{print $1}'

     tjn at node0:$ cexec :1 bash ./tmp.sh
     ************************* oscar_cluster *************************
     --------- node1---------
     tjn
     naughton
     tjn at node0:$


Note, the "}" in the awk command caused a problem for me when I just tried
this on the cluster from command-line:

   tjn at node0:~$ cexec :1 'cat /etc/passwd | grep -i naughton | awk -F: '{print $1}''
   ************************* oscar_cluster *************************
   --------- node1---------
   awk: line 2: missing } near end of file


I'd have to look more closely to see what's goofing up there, but the
temporary script approach works so I just use that for awk's brackets.

Hope that helps,
--tjn

  _________________________________________________________________________
   Thomas Naughton                                      naughtont at ornl.gov
   Research Associate                                   (865) 576-4184


On Thu, 2 Jan 2014, fwuwen at sina.cn wrote:

> 
> when i execute:
> 
> 
> cexce "ps -ef|grep java|awk '{print $2}'"
> 
> 
> this error:
> 
> awk: cmd. line:1: {print
> 
> awk: cmd. line:1:       ^ unexpected newline or end of string
> 
> 
> thank you
> 
> 
> ps:sorry, i am poor in english
> 
> 
>


More information about the c3-users mailing list