while loop issue

Hi,

Following is my code and the file FILE_LIST_EXCESS.txt has 40 file names in it

while read LineIn
do

echo ${LineIn}
      `ftp -vin << END_INPUT >> ${PID}_DS_GET_Log.log 2>&1
      open servername
      user userid password
      cd FileDir
      get ${LineIn}
      END_INPUT`
      GET_STATUS=`grep -ic "Transfer complete."${PID}_DS_GET_Log.log`
      rm -rf ${PID}_DS_GET_Log.log
    if [ ${GET_STATUS} != 0 ]
    then
     echo ${LineIn} >> FailedFileList.txt
    fi
done < FILE_LIST_EXCESS.txt

with the above code it exits after processing first file...
The code works fine with following basic code It reads all 40 files...

while read LineIn
do

echo ${LineIn}
      `ftp -vin << END_INPUT >> ${PID}_DS_GET_Log.log 2>&1
      open servername
      user userid password
      cd FileDir
      get ${LineIn}
      END_INPUT`
   echo ${LineIn} "Complete.."

done < FILE_LIST_EXCESS.txt

I have gone mad looking for a solution I would appreciate a solution for this.

Thanks,

What is the point of the back quoting?

porter is right here. There is no need of the back-quotes around the ftp command. And your END_INPUT should be at the beginning of the line. Even if you are using indentation in your code, the END_INPUT *must* be the first thing that the shell gets when it reads that line (no whitespace before that).

I think you're missing a space between the " and the $. It should be

      GET_STATUS=`grep -ic "Transfer complete." ${PID}_DS_GET_Log.log`

Cool Kahuna...That's right...It needs a dragon's eye to find out thanks a lot...