1833946 Members
2134 Online
110063 Solutions
New Discussion

errors

 
harikrishna
Advisor

errors

hi,
can anyone plz let me know how to handle the error for the following command.

ftp -n <
6 REPLIES 6
Sanjay Kumar Suri
Honored Contributor

Re: errors

You can do the following. Put the following in a script file say a.sh.

ftp -n << EOF
open xxxxxxxxxxx
user name passwd
cd /xxx/yyyy
ascii
get filename
quit
EOF

And execute with

#sh a.sh > out

sks

A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
harikrishna
Advisor

Re: errors

hi sanjay,
what ever you sent is fine and working .Thanks for giving the solution.but i want to know how to catch in side the script b'cause i am using that command 4 times in my script,based on erros i have to do the remainig connection.as per above model it leads to write many scripts.plz let me know any method to handle erros inside the script itself.

THANKS A LOT FOR GIVING THE SOLUTION

HARI
Sanjay Kumar Suri
Honored Contributor

Re: errors

Hello Hari

If you want you can check with if as given below:

if test -f out
then
echo "error"
else
echo "no error"
fi

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
harikrishna
Advisor

Re: errors

hi sanjay,
thanks for your help.i got the answer.it is
ftp -n << ! > logfile
--
---
--
bye
!
then errors are in log file.

THANKS

HARI
Hoefnix
Honored Contributor

Re: errors

If you do an ftp -n -v you wil get some more error information.

Regards,

Peter
Michael Schulte zur Sur
Honored Contributor

Re: errors

Hi Hari,

you still can take no action within the ftp script. I don't think, that's possible.

Michael