status code from ftp
    Rolf Wilson 
    rolf at sparc1.isgs.uiuc.edu
       
    Fri Feb  1 09:21:42 AEST 1991
    
    
  
I have a routine to transfer a file to another machine
by ftp. That part works fine. I want to delete the
file that I sent if the transfer worked. That part 
does not.
#!/bin/sh
ftp -n othermachine <<!
user me
put myfile
quit
!
if [ $? -eq 0 ]
then
  rm myfile
fi
The $? return code is always 0, even if the other machine
is never found. Does ftp not return a non-zero code on
failure? Is this not "the last command executed". What
horribly simple thing do I not understand?
  Replies by e-mail, please.
  Thank you very much.
--
Rolf Wilson   Illinois State Geological Survey   rolf at sparc1.isgs.uiuc.edu
    
    
More information about the Comp.unix.shell
mailing list