Fix arguments handling

Now all arguments are parsed. A non-valid argument will exit the program with an error.
This commit is contained in:
Alexis Ben Miloud--Josselin 2019-10-02 17:54:51 +02:00
parent 1cc11d39ee
commit c4f4166146

View file

@ -19,7 +19,7 @@ done
POW=$(echo 1024 ^ 3 | bc) POW=$(echo 1024 ^ 3 | bc)
FMT=human FMT=human
while [ $# -ne 0 ] && echo "$1" | grep -q '^-[[:alnum:]]' while [ $# -ne 0 ]
do do
case $1 in case $1 in
'-a') '-a')
@ -40,6 +40,7 @@ do
usage usage
;; ;;
esac esac
shift
;; ;;
'-u') '-u')
case $2 in case $2 in
@ -55,6 +56,7 @@ do
*) *)
usage usage
esac esac
shift
;; ;;
*) *)
usage usage