Skip to content
Myr

Fix attemptd assignment to non-variable in bash 3 (#628)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Fix attemptd assignment to non-variable in bash 3 flaghash variable is an associative array which is only supported in bash > 3. * Use -gt instead of >

authored by Kazuki Suda · committed by Eric Paris · parent 3a7eb14 · Browse files · 1 file+9 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−6 removed

  • other:+9 added−6 removed

1 file+9 added−6 removed

modified:bash_completions.go+9 added-6 removed
173 unmodified lines
174 commands=()175 fi176177 # keep flag value with flagname as flaghash178 # flaghash variable is an associative array which is only supported in bash > 3.179 if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then178 if [ -n "${flagvalue}" ] ; then179 flaghash[${flagname}]=${flagvalue}180 elif [ -n "${words[ $((c+1)) ]}" ] ; then181 flaghash[${flagname}]=${words[ $((c+1)) ]}182 else183 flaghash[${flagname}]="true" # pad "true" for bool flag180 if [ -n "${flagvalue}" ] ; then181 flaghash[${flagname}]=${flagvalue}182 elif [ -n "${words[ $((c+1)) ]}" ] ; then183 flaghash[${flagname}]=${words[ $((c+1)) ]}184 else185 flaghash[${flagname}]="true" # pad "true" for bool flag186 fi187 fi188189 # skip the argument to a two word flag190 if __contains_word "${words[c]}" "${two_word_flags[@]}"; then
350 unmodified lines