Skip to content

Instantly share code, notes, and snippets.

@sxd
Created November 10, 2015 15:04
Show Gist options
  • Save sxd/6909def7eee92dc80687 to your computer and use it in GitHub Desktop.
Save sxd/6909def7eee92dc80687 to your computer and use it in GitHub Desktop.
#!/bin/bash
DOMAIN=$1
DNS_SERVERS=("8.8.8.8" "8.8.4.4")
for DNS in ${DNS_SERVERS[@]}; do
ANSWER=(`dig @$DNS A $DOMAIN | grep -A 1 "ANSWER SECTION" | grep $DOMAIN | awk '{print $2" "$5}'`)
echo $DNS" -> TTL "${ANSWER[0]}" -> "${ANSWER[1]}
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment