Skip to content

Instantly share code, notes, and snippets.

@jubstuff
Created November 2, 2015 07:33
Show Gist options
  • Save jubstuff/6b86998c98fc40ca86be to your computer and use it in GitHub Desktop.
Save jubstuff/6b86998c98fc40ca86be to your computer and use it in GitHub Desktop.
Use this script to check which of the domains contained in file are pointing to the given domain
#!/bin/bash
# Use this script to check which of the domains contained in file are pointing to the
# given domain
# Credits: https://www.euperia.com/linux/howto-get-the-ip-address-of-a-domain-in-a-one-liner/385
# and various Stackoverflow users ^_^
if [ $# -eq 0 ]; then
echo "Usage ${0##*/} path/to/file domain"
exit 0
fi
file="$1"
domain="$2"
while read line; do
if dig +short A ${line} | grep -q $2; then
echo $line
fi
done <$file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment