1752806 Members
5719 Online
108789 Solutions
New Discussion юеВ

Re: 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 3
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