title: Checking for domain availability in bash with dig
body: <p>I am currently trying to write a script that will write out domains that it detects are available. The first idea was to write out any that include "NXDOMAIN", but this ended up including domains that I found I couldn't register.. so I added a requirement for "a.gtld-servers.net" also. The problem is, both of these conditions are being met on domains are ARE registered already. I'm fresh out of ideas with regards to what I can use to filter my results.</p>
  
  <p>Does anyone have any idea? here is my code:</p>
  
  <pre><code>function getResponse () {
     output=$(dig $1.com +nostats +noanswer +noquestion)
       if [[ $output == *NXDOMAIN* ]] &amp;&amp; [[ $output == *a.gtld-servers.net.* ]];  then
     echo "$1.com"
       fi
   }
  
  for v in {a..z}; do
    for w in {a..z}; do
      for x in {a..z}; do
        getResponse $v$w$x &amp;
        sleep 0.01s
      done
    done
  done
  
  for v in {a..z}; do
    for w in {a..z}; do
      for x in {a..z}; do
        for y in {a..z}; do
          getResponse $v$w$x$y &amp;
          sleep 0.01s
        done
      done
    done
  done
  </code></pre>