Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

ftp return values

Rick Taylor
Occasional Contributor

ftp return values

Is there a way to retrieve return values for ftp from within a korn shell script?
If its worth doing at all, its worth doing well!
3 REPLIES
Mike McKinlay
Honored Contributor

Re: ftp return values

Not sure what you mean here, but if you use the verbose switch you'll see all the answer-backs you get from the server. This will include the message number and text.

ftp -v
"Hope springs eternal."
Devbinder Singh Marway
Valued Contributor

Re: ftp return values

you can use here document in your script and then check if the ftp was successfull or not
e.g.

AAA=$(ftp -n hostname 2>&1 << EOD
user (name of user)
binary
put /get file
EOD
)

if [[ -n $AAA ]]
then
print ftp was not successfull
fi

hope this helps

cheers
Seek and you shall find
Bart Paulusse
Respected Contributor

Re: ftp return values

Here's the way I've solved the problem. (see attachment)
you have to be careful with the returncodes. Some rare event might result in a returncode that is not monitored in your script and promptly mess up your returncode handling.
I have to adjust the script regularly.
Some ftp commands are different or don't even exist on other versions of ftp (e.g. in Windows NT)

greetz