Bash script to check DNS records

#!/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
#       assumes there are 3 nics each with its own name, remove the last 2 stanzas if you only have a single nic and domain

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=".subdomain1.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=".subdomain2.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