whois: check multiple TLD’s availability

a cheap bash script to check the availability of domains.

easy enough to add more tld’s, though it would be better to write a switch with a check for each tlds “no match”, or equivalent, message.

[code language=”bash”]
#!/bin/bash

if [ "$#" == "0" ]; then
echo "You need to supply at least one argument!";
exit 1;
fi;

clear;

DOMAINS=(‘.com’ ‘.me’ ‘.co.uk’ ‘.net’ ‘.info’ ‘.mobi’ ‘.org’ ‘.tel’ ‘.biz’ ‘.eu’)
ELEMENTS=${#DOMAINS[@]}

while (( "$#" )); do
for (( i=0;i<$ELEMENTS;i++)); do
whois $1${DOMAINS[${i}]} | egrep -q ‘^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri’;
if [ $? -eq 0 ]; then
echo "$1${DOMAINS[${i}]} : Available";
else
echo "$1${DOMAINS[${i}]} : NOT AVAILABLE";
fi;
done;
shift;
done;

echo;
echo ‘Done’;
exit;
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *