From: Matthias Kruk Date: Thu, 20 May 2021 00:55:14 +0000 (+0900) Subject: include/opt: Work around bug in old bash versions X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=dde498a9a1a6bec031d2fb136282f4af66e766c4;p=toolbox include/opt: Work around bug in old bash versions Declaring a non-local array and initializing it in the same statement causes it to become local in older bash versions. This commit works around this bug by removing the array initializations from internal arrays of the opt module. --- diff --git a/include/opt.sh b/include/opt.sh index a654502..ea67f7f 100644 --- a/include/opt.sh +++ b/include/opt.sh @@ -8,14 +8,14 @@ __init() { declare -xgir __opt_flag_required=1 declare -xgir __opt_flag_has_value=2 - declare -Axg __opt_short=() - declare -Axg __opt_long=() - declare -Axg __opt_desc=() - declare -Axg __opt_flags=() - declare -Axg __opt_value=() - declare -Axg __opt_default=() - declare -Axg __opt_action=() - declare -Axg __opt_map=() + declare -Axg __opt_short + declare -Axg __opt_long + declare -Axg __opt_desc + declare -Axg __opt_flags + declare -Axg __opt_value + declare -Axg __opt_default + declare -Axg __opt_action + declare -Axg __opt_map declare -xgi __opt_num=0 declare -xgi __opt_longest=0