return code from host command

Stefan Puiu stefan.puiu at gmail.com
Wed Aug 31 05:59:02 UTC 2005


Well, first of all, some times it helps to mention the version of BIND 
you're using (the remark is for the OP). Or, more specifically, the version 
of BIND from which the two 'host' commands are coming. 
By looking at the code for 9.3.1 host (bin/dig/host.c) I see in the last 
line: 

return ((seen_error == 0) ? 0 : 1);

So, I guess a return code of 1 means some error happened, though I didn't 
check when 'seen_error' is set. Use either host -v or dig to see more of the 
details, by default host doesn't have an output you might call "verbose" :). 


On 8/30/05, Kurt Boyack <kboyack at gmail.com> wrote:
> 
> On 8/30/05, Smith, Earl (Exchange) <emsmith at bear.com> wrote:
> >=20
> > When I do a host command on a remote machine (not the DNS server), host
> > gives me a return code of 0 even when the machine is not found. When I
> > do the identical command on the DNS server I get the same answer, but
> > the return code is 1, which is what I would have expected. Why?
> >=20
> 
> I have never seen anything other than a return code of 0 from host
> when it is able to give an answer; even if the answer is "not found".
> It would make life easier if the host command would return a non zero
> exit code when no record is found.
> 
> 
>



More information about the bind-users mailing list