Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.