I recently discovered the FTP step of one of my UNIX shell scripts does not capture error codes:
Where ftp44 is another file with this script
I saw the FTP script in the FAQ and had a couple questions.
[ol]
[li]Am I correct if I said no exceptions are ever caught because it always returns "0"?[/li]
[li]What does the "i" parameter in my call do? I read some online manuals but could not find an explaination of what it does, exactly.[/li]
[li]Is there a reason the FTP script in the FAX uses "verbose" in the FTP script instead of the "v" flag?[/li]
[li]Why does the example use "exec" instead of calling another file, like mine?[/li]
[/ol]I am sure I will have more questions in the future.
Code:
echo '----------------------------------------------------------'
echo ' '
echo ' STEP02 -- UPLOAD LOAD FILE TO TMIC (FTP.RCP.PS44.LOAD) '
echo ' '
echo '----------------------------------------------------------'
echo "Executing ftp/ftp44..."
cd $HOME
ftp -i -n <ftp/ftp44
#Check if last command is successful.
if [ $? -ne 0 ]
then
echo "An error occurred while FTPing rcp44 load file from server to TMIC. "
echo ' ' | mailx -s "rcp44 has abended!! "`date '+%m/%d/%y'` DIS < rcp44.out
exit
fi
echo "FTP was done at `date`."
Code:
open TMIC
user user password
put /u003/tmp/rcp44.dat RCP.PS44.LOAD
quit
[ol]
[li]Am I correct if I said no exceptions are ever caught because it always returns "0"?[/li]
[li]What does the "i" parameter in my call do? I read some online manuals but could not find an explaination of what it does, exactly.[/li]
[li]Is there a reason the FTP script in the FAX uses "verbose" in the FTP script instead of the "v" flag?[/li]
[li]Why does the example use "exec" instead of calling another file, like mine?[/li]
[/ol]I am sure I will have more questions in the future.