[gdb/contrib] Fix shellcheck warnings in spellcheck.sh

Fix shellcheck warnings in spellcheck.sh, found using shellcheck v0.10.0.

Ran shellcheck v0.10.0 (on a system with shellcheck version 0.8.0) using this
command from an RFC patch [1]:
...
$ ./gdb/contrib/pre-commit-shellcheck.sh ./gdb/contrib/spellcheck.sh
...

Tested on x86_64-linux

[1] https://sourceware.org/pipermail/gdb-patches/2024-November/213400.html
This commit is contained in:
Tom de Vries 2024-11-19 12:32:40 +01:00
parent cb45bd5948
commit f5e259f32f

View File

@ -269,13 +269,13 @@ parse_dictionary ()
local i word replacement
i=0
for word in "${words[@]}"; do
replacement=${replacements[$i]}
replacement=${replacements[i]}
# Skip words that are already handled. This ensures that the local
# dictionary overrides the wiki dictionary.
if [ "${words_done[$word]}" == 1 ]; then
words[$i]=""
replacements[$i]=""
words[i]=""
replacements[i]=""
i=$((i + 1))
continue
fi
@ -283,8 +283,8 @@ parse_dictionary ()
# Skip identity rules.
if [ "$word" = "$replacement" ]; then
words[$i]=""
replacements[$i]=""
words[i]=""
replacements[i]=""
fi
i=$((i + 1))
@ -296,7 +296,7 @@ print_dictionary ()
local i word replacement
i=0
for word in "${words[@]}"; do
replacement=${replacements[$i]}
replacement=${replacements[i]}
i=$((i + 1))
if [ "$word" == "" ]; then
@ -519,7 +519,7 @@ main ()
local i word replacement
i=0
for word in "${words[@]}"; do
replacement=${replacements[$i]}
replacement=${replacements[i]}
i=$((i + 1))
if [ "$word" = "" ]; then