Skip to content

Instantly share code, notes, and snippets.

@jubstuff
Created November 2, 2015 07:33
Show Gist options
  • Select an option

  • Save jubstuff/6b86998c98fc40ca86be to your computer and use it in GitHub Desktop.

Select an option

Save jubstuff/6b86998c98fc40ca86be to your computer and use it in GitHub Desktop.

Revisions

  1. jubstuff created this gist Nov 2, 2015.
    21 changes: 21 additions & 0 deletions check_domains.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/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