SUMMARY: remote ssh awk within shell script

From: Dave Markham <>
Date: Thu Feb 08 2007 - 12:04:35 EST
Thanks to John Leadeham, Brain Catlin, Bill R.Williams, Aaron
Lineberger, Frisco

I actually got this working although perhaps not ideal and i dont fully
understand why it does work, but by missing any quotes of the ssh remote
command section it works :-

con_test_res_list=$( ${SSH} -l <user> $con_server 2>> $con_logfile egrep
\"^/\" $REM_BK_LOC_FILE |awk '{print $1}' )

Seems to return con_test_res as the contents of $1 on the remote server
file which matches ^/
The strange thing was i had 2>>$con_logfile at the end of the command
like i normally do, but that meant the ssh banner was coming back as
STDOUT which was very odd. Through trial and error i moved it there and
now its as it should be.

I then tried to get rid of the egrep and use it within awk


con_test_res_list=$( ${SSH} -l <user> $con_server 2>> $con_logfile awk
'/^\// {print $1}' )

but that isnt having any of it, its not liking the /^\// at all and by
putting quotes in various places im back to square one where $1 is
substituted remotely as the value on the local script.

Thanks to all who responded
sunmanagers mailing list
Received on Thu Feb 8 12:04:06 2007

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:04 EST