Created
September 16, 2014 09:26
-
-
Save greglearns/46a04443b7b35eba34b1 to your computer and use it in GitHub Desktop.
check domain availability
This file contains 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 characters
#!/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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment