Last active
July 23, 2021 04:26
-
-
Save StanBright/b236675e272ace1b385a9a0f2d543a1f to your computer and use it in GitHub Desktop.
Domain Name Search
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 | |
# Name: Check for domain name availability (as featured on https://stanbright.com/domain-name-search) | |
# | |
# To use this script, add it to your ~/bin directory and make it executable. | |
# Then you can search for specific domains like this: > domain_check.sh my-new-domain | |
# | |
# Alternatively: | |
# - Generate domain name ideas based on a keyword: https://www.saashub.com/namebounce-alternatives | |
# - Search domain names as you type: https://www.saashub.com/domaintyper-alternatives | |
# | |
# Please copy, share, redistribute and improve (linuxconfig.org) | |
if [ "$#" == "0" ]; then | |
echo "You need tu supply at least one argument!" | |
exit 1 | |
fi | |
DOMAINS=( '.com' '.io' ) | |
ELEMENTS=${#DOMAINS[@]} | |
while (( "$#" )); do | |
for (( i=0;i<$ELEMENTS;i++)); do | |
whois $1${DOMAINS[${i}]} | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri' | |
if [ $? -eq 0 ]; then | |
echo "$1${DOMAINS[${i}]} - available" | |
fi | |
done | |
shift | |
done |
It's be blank. Nothing.
You can easily show something by modifying the "if".
e.g.
if [ $? -eq 0 ]; then
echo "$1${DOMAINS[${i}]} - Available"
else
echo "$1${DOMAINS[${i}]} - Taken"
fi
Appreciate this, was intending to highlight that in the else condition if we can detail out further info regarding the occupancy but this is just fine as well. Also ran my domain day before and found out the rest two - .co & .io were taken up today - bad luck or is this too revealing?
whois was throwing an error for newly released TLDs on my old system
getaddrinfo(whois.dotproregistry.net): Name or service not known
so instead I used the less accurate, less detectable host nameserver lookup technique:
host -t ns $1${DOMAINS[${i}]} | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri|not found'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If its taken, what should be shown?