title: Speed up dig -x in bash script
body: <p>I have to run as an exercise at my university a bash script to reverse lookup all their DNS entries for a B class network block they own.</p>
  
  <p>This is the fastest I have got but takes forever.  Any help optimising this code?</p>
  
  <pre><code>#!/bin/bash
  network="a.b"
  
  CMD=/usr/bin/dig
  
  for i in $(seq 1 254); do
  
      for y in $(seq 1 254); do
          answer=`$CMD -x $network.$i.$y +short`; 
          echo $network.$i.$y ' resolves to ' $answer &gt;&gt; hosts_a_b.txt;
      done
  done
  </code></pre>