Shell Script Help

Hi Guys,

Can someone help me on ftping files via shell script please ?

i have created a script but its getting st-rucked after connecting to
the ftp location (i can see that logs).

Please see below i have pasted script and log.

#SCRIPT#
.env

set -a

##################
#Local Variables
##################

LOGDIR=/logs
LOGFILE=ftp.log
PICKUPDIR=/alpha/beta/
DROPDIR=/home/shiva/
DATE=`date +%Y-%m-%d`
GATEWAY=12.25.30.25
USERID=shivaprasath
PASSWD=cmm1234

###########
#FUNCTIONS#
###########

#function to pull Files

ftp_copy ()
{
        ftp -in $GATEWAY
        user ${USERID} ${PASSWD}
        cd ${PICKUPDIR}
        lcd ${DROPDIR}
        mget MP3_${DATE}*
        bye
!
} >> $LOGDIR/$LOGFILE

#############
#Main Script#
#############

echo "Starting Files ftp: \c" >> $LOGDIR/$LOGFILE
date >> $LOGDIR/$LOGFILE
ftp_copy
echo "Ending Files ftp: \c" >> $LOGDIR/$LOGFILE

wait

date >> $LOGDIR/$LOGFILE
exit 0

#End of Script#
# ftp.log#

Starting Files ftp: Wednesday,  4 April 2012 16:21:43 BST
Connected to 12.25.30.25.
Welcome to the FTP Site
Remote system type is Windows_NT.
ftp>
ftp>

Regards,
Shiva

ftp doesn't "eat" the lines below it when it's run. To redirect things into it, you have to redirect things into it.

       ftp -in $GATEWAY <<EOF
        user ${USERID} ${PASSWD}
        cd ${PICKUPDIR}
        lcd ${DROPDIR}
        mget MP3_${DATE}*
        bye
EOF

Note the last EOF is on the beginning of the line and MUST BE on the beginning of the line.

after adding EOF in script.. while running the script it is asking for password..

Please post the current version of the script and the matching output log.

Can you try a manual command-line ftp to verify that the username and password are valid for the ftp account on the NT server?

Please also post what Operating System and version you are running and what Shell this is. Please also post the version of Windows (start/run/winver) in case it is an old one.