From 15ddac722b244930e04a66fb147289a97ce6c1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Wed, 22 Feb 2023 11:27:35 +0100 Subject: subr.ex/ex_init.subr:ex_init_help(): reset OPTIND to 0 before calling getopts. --- subr.ex/ex_init.subr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subr.ex/ex_init.subr b/subr.ex/ex_init.subr index e15efda8..3fb6ccec 100644 --- a/subr.ex/ex_init.subr +++ b/subr.ex/ex_init.subr @@ -173,7 +173,8 @@ ex_init_getopts() { ex_init_help() { local _eih_rstatus="${1#\$}" _eih_args_long="${2}" \ _eih_name_base="${3}" _eih_optstring="${4}" \ - _eih_arg_long="" _eih_opt="" _eih_shiftfl=0; + _eih_arg_long="" _eih_opt="" _eih_shiftfl=0 \ + OPTIND; shift 4; while [ "${#}" -gt 0 ]; do @@ -211,6 +212,7 @@ ex_init_help() { ;; esac; + OPTIND=0; if getopts "${_eih_optstring}" _eih_opt 2>/dev/null; then case "${_eih_opt}" in h) -- cgit v1.2.3