-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdomain-availability
More file actions
executable file
·48 lines (33 loc) · 885 Bytes
/
domain-availability
File metadata and controls
executable file
·48 lines (33 loc) · 885 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
print_domain_result() {
DOMAIN="$1"
TLD=${DOMAIN##*.}
printf " - "
# checking if domain is available
if nslookup $DOMAIN &> /dev/null; then
echo "$DOMAIN is used."
return 0
fi
# checking if domain is premium
TMP_FILE=/tmp/domain-text
if whois $DOMAIN > ${TMP_FILE} 2> /dev/null; then
if grep -i "premium" ${TMP_FILE} &> /dev/null; then
echo "$DOMAIN is free and premium."
else
echo "$DOMAIN is free and not premium!"
fi
return 0
fi
rm ${TMP_FILE}
echo "$DOMAIN is free and *maybe* premium (not sure if is premium because whois from the command line doesn't seem to work with this domain; you have to manually check if is premium on a .${TLD^^} domain registrar webpage)."
}
non_line_break=true
for domain in "${@}"; do
if $non_line_break; then
non_line_break=false
else
echo
fi
print_domain_result "$domain"
done
exit 0