#!/bin/bash nameservers=('ns1.variomedia.de' 'london.finallycoffee.eu' 'munich.finallycoffee.eu') red='\e[1;31m' green='\e[1;32m' end='\e[0m' test_record() { local name=$1 local type=$2 local all_equal=true local res="" local all_res="$name@$type:\t" for ns in "${nameservers[@]}"; do answer="$(dig +short $type $name @$ns)" #echo "$answer" if [[ "$ns" == "$nameservers[0]" ]]; then res = answer fi if [[ "$res" != "$answer" ]]; then all_equal=false fi all_res="$all_res$answer\t" done if [[ all_equal ]]; then echo -e "${green}OK!\t$all_res${end}" elif [[ !all_equal ]]; then echo -e "${red}FAIL\t$all_res${end}" fi } if [[ -n "$1" ]] && [[ -z "$2" ]]; then test_record "$1" "A" test_record "$1" "AAAA" elif [[ -n "$1" ]] && [[ -n "$2" ]]; then test_record "$1" "$2" fi if [[ -z "$1" ]]; then while read -r line || [[ -n "$line" ]]; do type=${line##*@} name=${line%@$type} test_record "$name" "$type" done < records.list fi