aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <root@pigstarter.de>2014-06-16 17:43:20 +0200
committermakefu <root@pigstarter.de>2014-06-16 17:43:20 +0200
commitcadaec7a094b3df89ca3442f7b94ce0bd59cab3b (patch)
treee9ecf9ea238bd8499aa2ac2cfc7d4d41ec10cfe6
parentd31fe67cd498d63751e4163c642c7683f3d86bd1 (diff)
update taken script
-rwxr-xr-x[-rw-r--r--]commands/taken18
1 files changed, 9 insertions, 9 deletions
diff --git a/commands/taken b/commands/taken
index 0b7424e..b8beba6 100644..100755
--- a/commands/taken
+++ b/commands/taken
@@ -8,21 +8,21 @@
# 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
+if host "$d" | grep "NXDOMAIN" >&/dev/null; then
+ w=$(whois "$d")
+ if ! test "$?" -eq 0 ;then
+ echo "$d - whois not available"
+ elif echo "$w" | grep -Ei "(No match|NOT FOUND|Status: free)" >&/dev/null; then
echo "$d available";
+ elif echo "$w"| grep -Ei "(Status: invalid)" >&/dev/null ;then
+ echo "$d invalid"
else
- if whois $d >&/dev/null;then
- echo "$d taken";
- else
- echo "$d - whois not available"
- fi
+ echo "$d taken";
fi
else
echo "$d taken";
fi
done
+exit 0