LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-31-2005, 07:52 AM   #1
hinetvenkat
Member
 
Registered: Nov 2004
Location: Mumbai
Posts: 80

Rep: Reputation: 15
FTP upload


Hi all...

I tried to upload the file to all system in network. hostfile has all system IP. All are active now. I want to put the file in all system's user1 home folder.

In all system the user1 user account has also active. the numeric numbers are line numbers. i run the ftp script from 9 to 17 for a particular system using the another script file. That time FTP uploaded successfully.

problem : when i put the ftp segment inside of the for loop it give the error like

temp: line 19: syntax error: unexpected end of file

loop also fine.. i have doupt in these area. can we put the ftp segement for number of system. is there any fault. Kindly help me

Script:
-------

1 #!/bin/bash
2 echo "Enter the filename which has to be transfered : "
3 read trans_file
4 ftp_user='user1'
5 ftp_crpt='pass'
6 for i in `cat hostfile`
7 do
8 echo $i
9 ftp -in << EOF
10 open $i
11 quote USER $ftp_user
12 quote PASS $ftp_crpt
13 binary
14 hash
15 put txt
16 quit
17 EOF
18 done
 
Old 05-31-2005, 02:59 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: British Columbia, Canada
Distribution: Gentoo x86_64; FreeBSD; OS X
Posts: 3,764
Blog Entries: 4

Rep: Reputation: 78
"15 put txt"

What is 'txt'? In your script you call the file to transfer "trans_file"
To sniff out the syntax error, you need to repost your script with the correct formatting, and no line numbers. Please also use [code] blocks to make it easier to read
 
Old 05-31-2005, 10:20 PM   #3
hinetvenkat
Member
 
Registered: Nov 2004
Location: Mumbai
Posts: 80

Original Poster
Rep: Reputation: 15
Ok Here i have display my correct format script. Always i use correct aligned scripts. When i paste this script , It changed to the normal. Sorry for your inconvenience.


Script:
-------

#!/bin/bash

ftp_user='user1'
ftp_crpt='pass'

for i in `cat hostfile`
do
echo $i
ftp -in << EOF
open $i
quote USER $ftp_user
quote PASS $ftp_crpt
binary
hash
put txt
quit
EOF
done


## "txt" is a file which i want to put into the another machine.
## "hostfile" has the machine's IP list

Last edited by hinetvenkat; 05-31-2005 at 10:27 PM.
 
Old 06-02-2005, 10:34 PM   #4
hinetvenkat
Member
 
Registered: Nov 2004
Location: Mumbai
Posts: 80

Original Poster
Rep: Reputation: 15
Hello all,

Kindly tell me. why FTP session did not work in under for loop.

Here Ftp command also proper and for loop also.

Thanks
 
  


Reply


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
Cant upload to another FTP brandog Linux - Software 1 05-03-2003 03:47 PM
Upload limit on FTP twantrd Linux - General 3 04-28-2003 03:03 AM
Can't Upload FTP twantrd Linux - General 1 03-28-2003 10:15 PM
ftp upload hotrodowner Linux - Networking 20 10-11-2002 05:23 PM
ftp upload in php raven Programming 2 07-07-2002 06:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:16 PM.

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
Open Source Consulting | Domain Registration