ftp command in a bash scpipt

How to invoke ftp command in a bash script.
What is here document ? Here document let you do that


cat <<End-of-message
Message1
Message2
Message3
End-of-message
 

What about ftp?
Let me gess. you want to list un ftp folder ?

#!/bin/bash
 
# change the ipaddress accordingly
HOST="..."
# username also change
USER="..."
# password also change
PASSWD="..." 
 
 
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
ls
quit
END_SCRIPT
exit 0 
 

Now you want to upload one of your file ?

#!/bin/bash
 
# change the ipaddress accordingly
HOST="..."
# username also change
USER="..."
# password also change
PASSWD="..." 
 
 
FILE=$1
REMOTE_FILE=`basename $FILE`
 
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
verbose
put $FILE upload/$REMOTE_FILE
quit
END_SCRIPT
exit 0