Skip to content

Commit

Permalink
fix(bash-v2): activeHelp length check syntax (#1762)
Browse files Browse the repository at this point in the history
```shell
$ set -u
$ foo=()
$ echo ${#foo}
bash: foo: unbound variable
echo ${#foo[*]}
0
```
The above shows that an empty array needs the suffix `[*]` when checking its length, or else it is considered unbound.
  • Loading branch information
scop committed Aug 13, 2022
1 parent 7790bf9 commit f911c0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bash_completionsV2.go
Expand Up @@ -150,7 +150,7 @@ __%[1]s_process_completion_results() {
__%[1]s_handle_special_char "$cur" =
# Print the activeHelp statements before we finish
if [ ${#activeHelp} -ne 0 ]; then
if [ ${#activeHelp[*]} -ne 0 ]; then
printf "\n";
printf "%%s\n" "${activeHelp[@]}"
printf "\n"
Expand Down

0 comments on commit f911c0b

Please sign in to comment.