-   Linux - Software (
-   -   FTP upload (

hinetvenkat 05-31-2005 07:52 AM

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


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

bulliver 05-31-2005 02:59 PM

"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

hinetvenkat 05-31-2005 10:20 PM

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.




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

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

hinetvenkat 06-02-2005 10:34 PM

Hello all,

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

Here Ftp command also proper and for loop also.


All times are GMT -5. The time now is 11:43 PM.