summaryrefslogtreecommitdiffstats
path: root/check-hosts
diff options
context:
space:
mode:
Diffstat (limited to 'check-hosts')
-rwxr-xr-xcheck-hosts14
1 files changed, 10 insertions, 4 deletions
diff --git a/check-hosts b/check-hosts
index 13bdecc..f49a786 100755
--- a/check-hosts
+++ b/check-hosts
@@ -94,11 +94,17 @@ mode should be one of the following:
EOU
}
-optarr=( $(getopt -o 'absecn' --long 'all,bad,stale,extra,cron,nagios' -- "$@") )
+ARGS="$(getopt -o 'absecn' --long 'all,bad,stale,extra,cron,nagios' -- "$@")"
+
+if [ $? -ne 0 ]; then
+ show_usage
+ exit 1
+fi
+
+eval set -- "$ARGS"
-i=0
while true; do
- case ${optarr[$i]} in
+ case "$1" in
-a|--all)
get_all
exit 0
@@ -129,7 +135,7 @@ while true; do
exit 1
;;
esac
- ((i++))
+ shift
done
exit 0