From f5e259f32f011dc563b3da9e279acaee3aafba8e Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 19 Nov 2024 12:32:40 +0100 Subject: [PATCH] [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 --- gdb/contrib/spellcheck.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/contrib/spellcheck.sh b/gdb/contrib/spellcheck.sh index d15e12459c5..420891ff3ee 100755 --- a/gdb/contrib/spellcheck.sh +++ b/gdb/contrib/spellcheck.sh @@ -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 -- 2.39.5