Make page processor print usage only after reporting all bad opts

This commit is contained in:
ISSOtm
2020-10-23 00:40:05 +02:00
parent 7e1d20acdf
commit 12dc49b60a

View File

@@ -26,14 +26,12 @@ while getopts ":hr" opt; do
;;
\?)
echo "Unknown option '$OPTARG'"
if [ $bad_usage -eq 0 ]; then
usage
bad_usage=1
fi
bad_usage=1
;;
esac
done
if [ $bad_usage -ne 0 ]; then
usage
exit 1
fi
shift $(($OPTIND - 1))