aboutsummaryrefslogtreecommitdiffstats
path: root/commands/taken
blob: 0b7424ed812aa6415b9aa6914b8fdf45e0b272d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#!/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 -Ei "(No match|NOT FOUND|Status: free)" >&/dev/null; then
        echo "$d available";
    else
        if whois $d >&/dev/null;then
            echo "$d taken";
        else
            echo "$d - whois not available"
        fi
    fi
else
    echo "$d taken";
fi
done