remote ssh awk within shell script

From: Dave Markham (dave.markham@fjserv.net)
Date: Thu Feb 08 2007 - 06:38:43 EST


Has anyone tried or know a way of running a remote ssh command within a
script that contains an awk statement?

I cant get it to not take $1 as reference from the script.

e.g

Just in a shell this works :-

ssh -l <user> <host> "egrep \"^/\" /etc/novab_backup_location | awk
'{print $1}'"

But when its in a script like this :-

#!/bin/ksh

something=$1 #elswhere in script

con_test()
{
    con_test_res=`${SSH} -l <user> $con_server "egrep \"^/\"
$REM_BK_LOC_FILE |awk '{print $1}'" 2>>$con_logfile`
    echo Con_test_res is ["$con_test_res"]
}

con_test <server> |read file_list

It takes $1 as a variable which is passed to the script. The script is
much large and has the positional parameters for options used already.

I tried putting \ in front of the $ and all sorts. Perhaps ill have to
use cut or something.

Cheers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:41:36 EDT