summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-12-06 02:51:31 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2012-12-06 02:51:31 +0100
commitc8f9c918bb5cf5385447c54994fab6b9e196c08e (patch)
tree64251d4ceb7c6991138e2e998d9531a65636025d
parente36ccc63249d4c3d9050c80389503cb3d514547e (diff)
downloadbcfg2-tools-c8f9c918bb5cf5385447c54994fab6b9e196c08e.tar.gz
bcfg2-tools-c8f9c918bb5cf5385447c54994fab6b9e196c08e.tar.bz2
bcfg2-tools-c8f9c918bb5cf5385447c54994fab6b9e196c08e.zip
check-hosts: fix parameter handling
-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