Hi
I'm hoping I could get some help on the following. I'm writing a script which will in turn create an ftp script then excecute it. eg
echo "user $user $pass" > $script
echo "cd $remote_dir" >> $script
echo "bi" >> $script
echo "mput $file" >> $script
echo "bye" >> $script
ftp -n -i $ip < $script
I am having problems trapping errors if $remote_dir does not exist.
I've tried the following:
echo "cd $remote_dir" >> $script
echo "bi" >> $script
echo "mput $file" >> $script
echo "bye" >> $script
ftp -n -i $ip <$script
if [ $? -ne 0 ] then .......
This doesn't work because ftp always returns '0' even if $remote_ dir does not exist.
echo "cd $remote_dir" >> $script
echo "bi" >> $script
echo "mput $file" >> $script
echo "bye" >> $script
ftp -n -i $ip <$script 2>$error_file
Here an 'empty' error file is created on the remote server and error messages still display to screen.
How can I test for errors or how can I create an error file on the local server? Any help would be greatly appreciated!
Thanks
