Skip to content

Instantly share code, notes, and snippets.

@safarista
Created September 3, 2012 19:27
Show Gist options
  • Save safarista/3612643 to your computer and use it in GitHub Desktop.
Save safarista/3612643 to your computer and use it in GitHub Desktop.
Fast domain availability checker using bash
#!/bin/bash
# domainavailable
# Fast, domain name checker to use from the shell
# Use globs for real fun:
# domainavailable blah{1..3}.{com,net,org,co.uk}
# Inspired by foca / giles:
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
trap 'exit 1' INT TERM EXIT
for d in $@;
do
if host $d | grep "NXDOMAIN" >&/dev/null; then
if whois $d | grep -E "(No match for|NOT FOUND)" >&/dev/null; then
echo "$d AVAILABLE";
else
echo "$d taken";
fi
else
echo "$d taken";
fi
sleep 0.1;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment