diff options
Diffstat (limited to 'spelling/check-spelling.sh')
-rwxr-xr-x | spelling/check-spelling.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/spelling/check-spelling.sh b/spelling/check-spelling.sh index 7656dc4..fb86abe 100755 --- a/spelling/check-spelling.sh +++ b/spelling/check-spelling.sh @@ -3,7 +3,7 @@ set -Eeuo pipefail HTML_DIR="${1:-}" [[ -z "${HTML_DIR}" ]] && { - echo 'Undefined HTML_DIR.' + echo 'Undefined input HTML_DIR.' exit 2 } @@ -11,7 +11,7 @@ HTML_DIR="${1:-}" export LANG=C.UTF-8 for DICT in spelling/*.txt; do - diff <(sort $DICT) $DICT || { + diff <(sort "$DICT") "$DICT" || { echo "The $DICT dictionary is unsorted. To fix it, run:" echo " LANG=C.UTF-8 sort $DICT | sponge $DICT" exit 1 @@ -20,10 +20,11 @@ done hunspell -l -p <(cat spelling/international.dic.txt spelling/en_US.dic.txt spelling/en_US.aff.txt) -d en_US -i utf-8 $(find "$HTML_DIR" -type f -name '*.html') | tee spelling.txt cat spelling.txt -[[ -s spelling.txt ]] && { + +if [[ -s spelling.txt ]]; then echo "Mispelled words detected by hunspell." cat spelling.txt exit 1 -} || { +else echo "No words mispelled" -} +fi |