Created
September 16, 2014 09:26
-
-
Save greglearns/46a04443b7b35eba34b1 to your computer and use it in GitHub Desktop.
Revisions
-
greglearns created this gist
Sep 16, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ #!/bin/bash if [ "$#" == "0" ]; then echo "You need to supply at least one domain name!" exit 1 fi DOMAINS=( 'com' \ 'me' \ 'us' \ 'org' \ 'it' \ 'sk' \ 'sh' \ 're' \ 'io' \ 'in' \ 'co' ) ELEMENTS=${#DOMAINS[@]} while (( "$#" )); do for (( i=0;i<$ELEMENTS;i++)); do domain=$1.${DOMAINS[${i}]} printf $domain ipaddress=`dig $domain +short` if [[ "$ipaddress" == "" ]]; then whois $domain | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri|is availablef for' if [ $? -eq 0 ]; then printf " : available" fi fi echo done shift done