LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error in FTP - reading file using For loop (https://www.linuxquestions.org/questions/linux-newbie-8/error-in-ftp-reading-file-using-for-loop-4175549371/)

publicLearner 07-30-2015 11:37 AM

Error in FTP - reading file using For loop
 
Hi Forum Members,

I'm trying to read a file, and send respective file_names from the file to FTP server.
I'm running this script where all respective files are present.

Here's my code:

Code:

#!/usr/bin/env bash

# __date__
# __author__
# __location__

file_symbolik_links="/home/ST131s/symbolik_links/test.txt"
HOST="name"
USER="lab_user"
PASSWD="pasword"
REMOTEPATH="/daniel/Fastq_gz/"

for name in `cat $file_symbolik_links | sort`
do
       
        ftp -v -n $HOST<<EOT
        quote USER $USER
        quote PASS $PASSWD
        cd $REMOTEPATH
          prompt off
        put $name
        bye
        EOT
        exit 0       
done

printf "Done sending files\n"

Error:

Quote:

line 27: warning: here-document at line 16 delimited by end-of-file (wanted `EOT')
line 28: syntax error: unexpected end of file
I run this as
bash script.sh

- I'm unable to figure out a way to fix this.
- If I remove exit 0, then again I get same error.
Linux version:

Quote:

lsb_release -a

4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.6 (Santiago)
Release: 6.6
Codename: Santiago
l
Please guide.

Thanks.

publicLearner 07-30-2015 12:12 PM

Update:
Fixed it.
EOF at line 24 needed to be indented with do.

Found solution from:

http://askubuntu.com/questions/48556...ed-end-of-file


All times are GMT -5. The time now is 01:58 AM.