[SunHELP] How to trap ftp error codes
Sandwich Maker
adh at an.bradford.ma.us
Thu Jul 24 13:22:43 CDT 2003
"From: Naser Ali <Ali.Naser at irs.gov>
"
"I am trying to trap ftp return code or error code to make my automated ftp
"script more robust. Is there a way to accomplish this.
"
"Any pointers will be great help.
in ksh, $? is always the exit value of the last command executed. so
you could do something like
#!/usr/bin/ksh -p
ftp <target> <<-EOFTP
.
.
.
.
bye
EOFTP
if (( $? ))
then # nonzero, ftp failed
print -u2 "\n${0##*/}: warning! ftp failed!\nreturn code was $?\nerror number was $ERRNO\n"
else # zero, ftp succeded
print "hooray! all done."
fi
btw, ksh supports $ERRNO, if that has any value.
you might also want to look into wget and/or curl.
________________________________________________________________________
Andrew Hay the genius nature
internet rambler is to see what all have seen
adh at an.bradford.ma.us and think what none thought
More information about the SunHELP
mailing list