title: How to use nslookup in bash to verify is DNS is configured properly?
body: <p>Mainly I want to detect if DNS is configured properly on a machine by using <code>nslookup</code>. Sadly it seems that nslookup still returns success error codes when it fails to lookup an entry. Also the fact that different queries could return multiple results makes it harder to test it.</p>
  
  <p>So I want to write a bash snippet that returns success if the dns entry resolved successfully. I don't care if I get multiple results.</p>
  
  <p>Example <code>nslookup -type=srv _ldap._tcp.DOMAIN.COM</code></p>