]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/contrib] Fix shellcheck warnings in spellcheck.sh
authorTom de Vries <tdevries@suse.de>
Tue, 19 Nov 2024 11:32:40 +0000 (12:32 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 19 Nov 2024 11:32:40 +0000 (12:32 +0100)
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

gdb/contrib/spellcheck.sh

index d15e12459c5c38f7eeb98d710eae957ccd879938..420891ff3eeec25d85cd68b65ad4679a25321d8b 100755 (executable)
@@ -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