[Solved] Not able to read the next line from a file after doing ssh

Hi,
I am trying to write a code, where it reads the jobnames from a file and checks for the logs in the server. If the log is not found in the first server, then it will ssh to the 2nd server and get the details from there. I will need to save the date in a variable.
But the problem is that, after doing that ssh, it is not able to read the next line. The script is ending there treating it as end of file.

#Checking in Dime2 if not available in DIME1
if [ -z "$job_start1_date1" ]
then
job_start1_date1=`ssh -l uiaa10 abc "grep $job1 /log/abc.com/ca7en2.out|tail -2|grep -i JOBTERM|cut -d \" \" -f11"`
job_start_time1=`ssh -l uiaa10 abc "grep $job1 /log/abc.com/ca7en2.out|tail -2|grep -i JOBTERM|cut -d \" \" -f12"`
fi

I am using a while loop to read the contents of the file. Please let me know on how to read the file as usual after the above statements.

Thanks
Ajay

---------- Post updated at 07:22 PM ---------- Previous update was at 06:38 PM ----------

Hi,

ssh -n

resolved the problem. It is working as expected now.

Thanks
Ajay

1 Like