1
1
Hello.
ssh ufk@10.0.0.2 "bash -lc 'pm2 list | grep app | awk { print $3} '"
I need to run the command I pasted here. the problem is that i'm already escaping twice... the bash with "
and the pm2 with '
. how can i escape awk ?
i know that it will work if i escape it with awk '{ print $3 }' but the all command is already escaped twice... so .. what do i do ?
update
i created the following bash command:
PM2_APP_ID=`$REMOTE_SRV_SSH_COMMAND "bash -lc \"pm2 list | grep app | grep -v 'pm2 show' | awk '{ print \\\$4 }'\""`;
here i get the all pm2 list relevant line, it's like awk is never been executed.
1
awk
can do most cases ofgrep
and you don't really need those done remotely, sossh u@h "bash -lc 'pm2 list' " | awk '/app/{print $3}'
will also work – dave_thompson_085 – 2015-08-04T19:48:38.310thanks @dave_thompson_085, you helped me resolve the issue – ufk – 2015-08-23T09:13:41.483