diff --git a/spellcheck.sh b/spellcheck.sh index f6faef6b7..bba3decc2 100755 --- a/spellcheck.sh +++ b/spellcheck.sh @@ -36,9 +36,9 @@ dict_filename=dictionary.txt markdown_sources=(./src/*.md) mode="check" -# aspell repeatedly modifies personal dictionary when checking interactively, +# aspell repeatedly modifies personal dictionary for some purpose, # so we should use a copy of our dictionary -dict_path="/tmp/dictionary.txt" +dict_path="/tmp/$dict_filename" if [[ "$1" == "list" ]]; then mode="list" @@ -55,11 +55,11 @@ if [[ ! -f "$dict_filename" ]]; then cat "${markdown_sources[@]}" | aspell --ignore 3 list | sort -u >> "$dict_filename" elif [[ "$mode" == "list" ]]; then # List (default) mode: scan all files, report errors + cp "$dict_filename" "$dict_path" declare -i retval=0 for fname in "${markdown_sources[@]}"; do - echo "command = aspell --home-dir=. --ignore 3 --personal=\"$dict_filename\" \"$mode\" < \"$fname\"" - command=$(aspell --home-dir=. --ignore 3 --personal="$dict_filename" "$mode" < "$fname") + command=$(aspell --ignore 3 --personal="$dict_path" "$mode" < "$fname") if [[ -n "$command" ]]; then for error in $command; do # TODO: Find more correct way to get line number