LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-30-2015, 12:37 PM   #1
publicLearner
LQ Newbie
 
Registered: Mar 2015
Location: Washington, DC
Distribution: Mac 10.10 Yosemite
Posts: 24

Rep: Reputation: Disabled
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-amd64rinting-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.

Last edited by publicLearner; 07-30-2015 at 12:53 PM.
 
Old 07-30-2015, 01:12 PM   #2
publicLearner
LQ Newbie
 
Registered: Mar 2015
Location: Washington, DC
Distribution: Mac 10.10 Yosemite
Posts: 24

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply

Tags
bash, ftp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
while loop only reading the first line of hostnames in file keif Programming 3 12-13-2013 08:28 AM
[SOLVED] Reading a multiple file inside loop and store! rameshpaul_cog Linux - Newbie 13 06-20-2012 05:25 AM
[SOLVED] Function goes into infinite loop when reading from a file vikas027 Programming 9 10-08-2011 01:54 AM
[SOLVED] Bash - While Loop reading from two lists simultaneously - nested while loop wolverene13 Programming 11 10-01-2011 06:00 PM
Unexpected result in while do done loop reading file steven.c.banks Linux - General 2 05-01-2008 01:32 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration