ssh - to execute set of commands

Hi

Can someone help me to figure out

Want to execute few cmds in remote host thru ssh

Tried below cmd

-------------------------------excerpt-------------------

 RDIR=/data1/logs  ---> variable stores rem. server directory
 TODAY="`date '+%b %d'`"  
 ssh -i $userid@$host "cd $RDIR;grep -il "ERROR" `ls -l $RDIR|grep $TODAY" |awk  '{print $NF}'` 2>/dev/null|wc -l" 

-------------------------------excerpt-------------------

throws below err

ksh: 27:  not found 
 grep: RE error 41: No remembered search string.

any help would be greatly appreciated

tks

Hi.

I wasn't able to test this, but your command should look more like:

ssh $userid@$host "cd $RDIR;grep -il 'ERROR' \$(ls -l $RDIR | grep \"$TODAY\" | awk '{print \$NF}') | wc -l"

It works......Thanks a lot Scottn