When getopts is called multiple time we need to reset OPTIND. (#3475)

Not resetting OPTIND between each call of getopts skips all short args except the first one.

It fixes this automated command: 
./certbot-auto certonly --webroot -w /tmp -d example.com --agree-tos --email contact@example.com -n

Where "-w" was parsed by getopts and not "-n"

* When getopts is called multiple time we need to reset OPTIND. Issue #3459 

* Adding OPTIND reset in the certbot-auto source file

* Building new letsencrypt-auto from template
This commit is contained in:
tcottier
2016-10-28 11:18:56 -07:00
committed by Brad Warren
parent 88a2c5a8f6
commit 5ed0f3610c
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -58,6 +58,7 @@ for arg in "$@" ; do
--verbose)
VERBOSE=1;;
-[!-]*)
OPTIND=1
while getopts ":hnvq" short_arg $arg; do
case "$short_arg" in
h)
@@ -58,6 +58,7 @@ for arg in "$@" ; do
--verbose)
VERBOSE=1;;
-[!-]*)
OPTIND=1
while getopts ":hnvq" short_arg $arg; do
case "$short_arg" in
h)