Skip to content

Instantly share code, notes, and snippets.

@laktek
Forked from peterc/domainavailable
Created February 13, 2009 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laktek/63922 to your computer and use it in GitHub Desktop.
Save laktek/63922 to your computer and use it in GitHub Desktop.
#!/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 nslookup $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