I wish to run some ftp commands from a shell script. I thought that this would be easily done with the following...
++++++++
ftp -inv $IP <<-ENDFTP >$DIALOG
user $USER $PASSWORD
cd /home/user1/log
bin
put $REF_FILE $TO_REF_FILE
bye
ENDFTP
status=`grep -c "Not connected" $DIALOG`
if [ $status != "0" ]
then
echo "ERROR - Connection to distribution system is down, $IP"
exit 4
fi
----------
The ftp works fine and the appropriate messages get sent to the $DIALOG file. However the rest of the shell script seems to be ignored. The line starting status= never gets run.
I have also tried without redirection to the $DIALOG file as follows, again the following echo command does nbot get run.
+++++++
ftp -inv $IP <<-ENDFTP
user $USER $PASSWORD
cd /home/user1/log
bin
put $REF_FILE $TO_REF_FILE
bye
ENDFTP
echo "Here I am"
-------
Shell is ksh and all of the variables are ok ( thus the ftp actually working fine).
Any suggestions as to why the rest of the script is not executing?
Cheers
Mike
++++++++
ftp -inv $IP <<-ENDFTP >$DIALOG
user $USER $PASSWORD
cd /home/user1/log
bin
put $REF_FILE $TO_REF_FILE
bye
ENDFTP
status=`grep -c "Not connected" $DIALOG`
if [ $status != "0" ]
then
echo "ERROR - Connection to distribution system is down, $IP"
exit 4
fi
----------
The ftp works fine and the appropriate messages get sent to the $DIALOG file. However the rest of the shell script seems to be ignored. The line starting status= never gets run.
I have also tried without redirection to the $DIALOG file as follows, again the following echo command does nbot get run.
+++++++
ftp -inv $IP <<-ENDFTP
user $USER $PASSWORD
cd /home/user1/log
bin
put $REF_FILE $TO_REF_FILE
bye
ENDFTP
echo "Here I am"
-------
Shell is ksh and all of the variables are ok ( thus the ftp actually working fine).
Any suggestions as to why the rest of the script is not executing?
Cheers
Mike