You are not logged in.

#1 2017-06-19 18:24:58

ua4000
Member
Registered: 2015-10-14
Posts: 62

[SOLVED] drill as nslookup replacement

I'm stuck with a script, where I have to check if a domain/subdomain exists.

nslookup  $domain >/dev/null 2>/dev/null; echo $?
drill $domain >/dev/null 2>/dev/null; echo $?

The old way with nslookup works fine, exit code is non-zero for invalid/non-existing domains.
The new way with drill always gives me status 0 :-(

Any ideas ?
Is there a better solution ?

Thanks very much.

Last edited by ua4000 (2017-06-21 16:05:17)

Offline

#2 2017-06-19 21:05:08

brebs
Member
Registered: 2007-04-03
Posts: 3,636

Re: [SOLVED] drill as nslookup replacement

Can use getent hosts.

Offline

#3 2017-06-21 16:04:51

ua4000
Member
Registered: 2015-10-14
Posts: 62

Re: [SOLVED] drill as nslookup replacement

$ getent hosts unix.stackexchange.com; echo $? 
...
0
$ getent hosts unix.stackexchange.comm; echo $? 
2

Great !!!

Thank you very much!

Offline

Board footer

Powered by FluxBB