From 8d65163283a25f27456148b24885ee8248768e23 Mon Sep 17 00:00:00 2001 From: Erik Phillips Date: Fri, 3 Jun 2016 17:51:56 -0600 Subject: [PATCH] Added support for handling -- will stop parsing arguments when encountered. Original fix by K-ko. --- optparse.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/optparse.bash b/optparse.bash index 894c8fc..b168c29 100644 --- a/optparse.bash +++ b/optparse.bash @@ -104,7 +104,11 @@ while [ \$# -ne 0 ]; do usage exit 0;; *) - if [[ "\$param" == --* ]]; then + if [[ "\$param" == -- ]]; then + # getopts will handle the "--" correct and stops parsing + params="\$params -- \$@" + break + elif [[ "\$param" == --* ]]; then echo -e "Unrecognized long option: \$param" usage exit 1