Fix command line argument parsing

This commit is contained in:
Jonny007-MKD 2021-01-17 12:59:36 +01:00
parent f363bc15e2
commit 30a21e5d2e
1 changed files with 3 additions and 4 deletions

View File

@ -22,22 +22,20 @@ while [[ $# -gt 0 ]]; do
''|*[!0-9]*) echoerr "Value for \"$1\" has to be a number"; exit -3;;
esac
WARN=$2
shift; shift
shift
;;
-c|--crit|--critical)
case "$2" in
''|*[!0-9]*) echoerr "Value for \"$1\" has to be a number"; exit -3;;
esac
CRIT=$2
shift; shift
shift
;;
-f|--fahrenheit)
FAHRENHEIT=true
shift
;;
-d|--debug)
DEBUG=true
shift
;;
-?|--help)
echo "Check /proc/mdstat. Arguments:"
@ -82,6 +80,7 @@ if $FAHRENHEIT; then
fi
log "$temp$unit. Warn: $WARN, Crit: $CRIT"
c=$(bc <<< "$temp > $CRIT")
w=$(bc <<< "$temp > $WARN")