FTP file to different hosts

Guys hw ya all doing.by the way wrote a script which is below.

f()
{

for host in hostname1 hostname2; do
{
#host=hostname1
user = 'rocky'
pass = 'rocky'
#ftp to particular server

ftp -v $host
quote USER $user
quote PASS $pass
bin
cd /bin/rocky
mkdir rock
cd /bin/rocky/rock/
mput file1

bye
}
done
}
f

I need to ftp to those two servers(hostname1 &hostname2) and put the file (file1) in tht particular path.while iam using this script the script is again asking me for login instead of reading the username and password provided.cn some one help me with this.

Thanks fellas
CK

f()
{
  for host in hostname1 hostname2; do

    user=rocky
    pass=rocky

    #ftp to particular server

    ftp -v $host <<-EOF
	USER $user
	PASS $pass
	bin
	cd /bin/rocky
	mkdir rock
	cd /bin/rocky/rock/
	mput file1
	bye
EOF

  done
}

I beleive you would use:

ftp $user:$pass@$hostname

do a man ftp

When I ran the modified script I got the output like this.

OUTPUT:

Connected to hostmachine1.
220- _________________________________________________________________

220 (vsFTPd 1.2.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (hostmachine1:rocky): 331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
?Invalid command
530 Please login with USER and PASS.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
mput file1? 530 Please login with USER and PASS.
Passive mode refused. Turning off passive mode.
530 Please login with USER and PASS.
ftp: bind: Address already in use
221 Goodbye.
Connected to hostmachine2.
220- _________________________________________________________________
220-
220 (vsFTPd 1.2.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (hostmachine2:rocky): 331 Please specify the password.
Password:
530 Login incorrect.
Login failed.
?Invalid command
530 Please login with USER and PASS.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
mput file1? 530 Please login with USER and PASS.
Passive mode refused. Turning off passive mode.
530 Please login with USER and PASS.
ftp: bind: Address already in use
221 Goodbye.

It is better to put the name and password in your .netrc file.