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'" echo "Unknown option '$OPTARG'"
if [ $bad_usage -eq 0 ]; then bad_usage=1
usage
bad_usage=1
fi
;; ;;
esac esac
done done
if [ $bad_usage -ne 0 ]; then if [ $bad_usage -ne 0 ]; then
usage
exit 1 exit 1
fi fi
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))