Skip to content

Instantly share code, notes, and snippets.

@applicato
Forked from sathishmanohar/find_domain
Created September 26, 2018 13:03
Show Gist options
  • Select an option

  • Save applicato/0a3c4d3c19aa6f6b90acab6f36f5e8e1 to your computer and use it in GitHub Desktop.

Select an option

Save applicato/0a3c4d3c19aa6f6b90acab6f36f5e8e1 to your computer and use it in GitHub Desktop.
Find .com Domain availability from terminal
#!/bin/bash
while [ "$name" != "exit" ]
do
# Get the Domain Name from User
echo "What domain name do you want?: [Enter]"
read name
# Check if the input is not empty or just spaces
if [[ -z "${name// }" ]]; then
echo "Input is empty"
continue
fi
# Check if the input has .com in it
if [[ ! "$name" =~ ".com" ]]; then
echo "Enter valid .com domain"
continue
fi
# Check if the input domain is available
if whois $name | grep -q 'No match for'; then
echo "Available"
else
echo "Oops. Taken"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment