shell script to ftp multiple files

Hi,

i use the below script to send a single file to remote server from linux.

                ftp -nvi <<!EOF
                open $Host_name
                user $USER_ID $PWD
                binary
                mput $file_name
                quit
                !EOF (where i get host,user and pwd from another file)

what if i want to send multiple file as input.
the script should be run as,

>> ./ftp.sh file1 file2 file3 file4

the no.of file given as input will vary!:confused:

thanks,
Pradeep

#!/bin/ksh   
ftp_it()
{
ftp -nvi <<!EOF
  open $Host_name
  user $USER_ID $PWD
  binary
  mput "$1"
quit
!EOF 
}
              
cnt=1                      
set -A arr "$@"            
while [ $cnt -lt $# ]      
do                         
   ftp_it ${arr[cnt]}
   cnt=$(( $cnt + 1 ))
done                       

hi,

i get an syntax error:

new.sh: syntax error at line 4: `<<' unmatched
please help!!

---------- Post updated at 09:55 PM ---------- Previous update was at 09:51 PM ----------

i have soreted out the syntax error!

now i get the below error:
ftp: user home/prad/tools/FTP: Servname not supported for ai_socktype
(to) Not connected.
Not connected.

pls help :confused: