Check FTP Status

To all,
I need to run a ftp command in one of my scripts and I need to evaluate what happens after it's done. The problem is the script would not capture the ftp responses. If I type the same thing on the command
line, I get all kinds of responses. I would like to capture the same responses in my script.

Any suggestions?

------------------------------------------------------------------
Here is what it looks like in my script:

ftp -n -i 123.123.123.123 <<EOF >test
ascii
close
quit
EOF

Result: test is empty.

------------------------------------------------------------------
I tried this:

echo open 123.123.123.123 >>rin
echo ascii >>rin
echo close >>rin
echo quit >>rin

ftp -n -i <rin >test

Result: test is empty.

------------------------------------------------------------------
I typed the ftp command on the command line:

ftp -n -i 123.123.123.123
Connected to 123.123.123.123.
220-NETIFTP1 IBM FTP CS V1R7 at 123.123.123.123, 18:08:57 on 2007-08-03.
220 Connection will close if idle for more than 5 minutes.
ftp> open
Already connected to 123.123.123.123, use close first.
ftp> ascii
c200 Representation type is Ascii NonPrint
ftp> close
221 Quit command received. Goodbye.
ftp> quit

ftp 123.123.123.123 <<EOF 2>&1 >/tmp/ftp.output
ascii
close
quit
EOF

If you want to capture ALL the output, not only errors, give the

verbose

command.
i.e.

ftp 123.123.123.123 <<EOF 2>&1 >/tmp/ftp.output
verbose
ascii
close
quit
EOF

bye.