Skip to content

Instantly share code, notes, and snippets.

@izmailoff
Last active December 16, 2015 10:59
Show Gist options
  • Save izmailoff/5424470 to your computer and use it in GitHub Desktop.
Save izmailoff/5424470 to your computer and use it in GitHub Desktop.
Check available domain names with this convenience tool.
#!/bin/bash
# takes one argument as domain name and checks if this domain is registered.
#
# usage:
# sss google.com
#
function sss()
{
if [ $# -eq 0 -o -z "$1" ]; then
echo "You must provide a domain name."
return
fi
if [ $(whois "$1" | grep -i 'registrant:' | wc -l) -ge "1" ]; then
echo TAKEN;
else
echo AVAILABLE;
fi
}
@izmailoff
Copy link
Author

Unfortunately, whois is not very consistent in its results from different tld. Changing the script to use grep instead of exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment