A script I created to validate the entries in DNS without having access to the zone files or being able to perform a zone transfer

#!/bin/bash
#This script will perform..
# 1. forward lookups on a list of dns shortnames
# 2. it will then perform reverse lookups on the ips returned
# 3. it will then perform the same steps again for various sub domains
# Note: replace example with your domain name , input a list of either shortnames or FQDNs

for short_name in `head  list_systems | awk -F. '{ print $1 }'` 
  do
  domain_name=".example.local"
  host $short_name$domain_name
    if [ $? = '0' ] ; then
     fw_ip="`host $short_name$domain_name | awk '{ print $4}'`" 
     host $fw_ip  
         if [ $? = '0' ] ; then
           bw_ip="`host $fw_ip | awk '{ print $5 }'`"
            >> out
          else 
           echo "$short_name$domain_name reverse failed $fw_ip" >> errors
           bw_ip=""
         fi
    else
     echo "$short_name$domain_name forward failed" >> errors
     fw_ip=""
    fi

  domain_name=".management.example.local"
  host $short_name$domain_name
    if [ $? = '0' ] ; then
     m_fw_ip="`host $short_name$domain_name | awk '{ print $4}'`" 
     host $fw_ip  
         if [ $? = '0' ] ; then
           m_bw_ip="`host $m_fw_ip | awk '{ print $5 }'`"
           echo $short_name$domain_name","$m_fw_ip","$m_bw_ip"," >> m_out
          else 
           echo "$short_name$domain_name reverse failed $m_fw_ip" >> m_errors
           m_bw_ip=""
         fi
    else
     echo "$short_name$domain_name forward failed" >> errors
     m_fw_ip=""
    fi

  domain_name=".backupnetwork.example.local"
  host $short_name$domain_name
    if [ $? = '0' ] ; then
     b_fw_ip="`host $short_name$domain_name | awk '{ print $4}'`" 
     host $fw_ip  
         if [ $? = '0' ] ; then
           b_bw_ip="`host $m_fw_ip | awk '{ print $5 }'`"
           echo $short_name$domain_name","$b_fw_ip","$b_bw_ip"," >> b_out
          else 
           echo "$short_name$domain_name reverse failed $b_fw_ip" >> b_errors
           b_bw_ip=""
         fi
    else
     echo "$short_name$domain_name forward failed" >> errors
     b_fw_ip=""
    fi

  echo $short_name$domain_name","$fw_ip","$bw_ip",""$m_fw_ip","$m_bw_ip",""$b_fw_ip","$b_bw_ip"," >> out
done