Skip to content

Instantly share code, notes, and snippets.

@igrigorik
Forked from peterc/domainavailable
Created March 23, 2010 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save igrigorik/340794 to your computer and use it in GitHub Desktop.
Save igrigorik/340794 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 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