send files through ftp using proxy in a loop

Hi,

I have a problem with sending files to ftp using proxy.
When using this script:

#!/bin/bash
DIR=/dane_wz
ftp -n -v 172.30.100.13 << EOF
quote USER xxx@172.25.240.45
quote PASS xxxx
passive
cd $DIR
quit
EOF

it works fine and I get connection with FTP server, but using the same in a loop:

#!/bin/bash
DIR=/home/mf/mfinpazp
while RES=$(inotifywait -e create $DIR); do
    FILE=${RES#?*CREATE }
    if [ ${FILE: -3} == ".wz" -o  ${FILE: -4} == ".md5" ] ; then
         ftp -n -v 172.30.100.13 << EOF
         quote USER xxx@172.25.240.45
         quote PASS xxxx
         passive
         cd /dane_wz
         quit
EOF
     fi
done

keeps giving me this error:

220 Welcome to MFW Gateway
530 proxy: login incorrect
502 proxy: command not implemented

Any idea how to solve it?

ukasz

You can't indent lines in a here-document unless you use <<-
e.g:

         ftp -n -v 172.30.100.13 <<-EOF

thanks for reply,

but neither putting - (minus) nor removing all indents works here, I have made it look easier:

#!/bin/bash
DIR=/home/mf/mfinpazp
while RES=$(inotifywait -e create $DIR); do
ftp -n -v 172.30.100.13 << EOF
quote USER xxxxxxxx
quote PASS xxxxx
quit
EOF
done

and still same error "login incorrect"

ukasz