Result Code of FTP Script
Brad De Vries
devriesbj
Fri Dec 17 16:42:47 PST 2004
Hey all, does anyone know of a way to obtain the result code of an FTP script?
I have a script file:
-----------
open rmt_srv
user test test123
cd /incoming
put file1
bye
-----------
When I run "ftp -inv < script_file" the result code is always zero
even when it fails to connect to the remote server or login.
What I'd like to do is:
-----------
ftp -inv < script_file
rc=$?
if [ $rc -eq 0 ]; then
rm -f file1
else
echo "FTP Failure"
fi
exit $rc
-----------
Any thoughts anyone?
TIA,
Brad.
More information about the Linux-users
mailing list