You are not logged in.
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
Can use getent hosts.
Offline
$ getent hosts unix.stackexchange.com; echo $?
...
0
$ getent hosts unix.stackexchange.comm; echo $?
2
Great !!!
Thank you very much!
Offline