Skip to content

Commit

Permalink
Make grep exit with 0
Browse files Browse the repository at this point in the history
grep exits with 1 if there is no match found,
which makes the pipeline fail due to the pipefail
option
Also make grep case insensitive
  • Loading branch information
agitter committed Apr 28, 2020
1 parent 24241ee commit 311269d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ fi
# Spellcheck
if [ "${SPELLCHECK:-}" = "true" ]; then
export ASPELL_CONF="add-extra-dicts $(pwd)/build/assets/custom-dictionary.txt; ignore-case true"
pandoc --lua-filter spellcheck.lua output/manuscript.md | uniq | while read word; do grep -on "\<$word\>" content/*md; done | sort -h -t ":" -k 1b,1 -k2,2 > output/spelling-errors.txt
# Use "|| true" after grep because otherwise this step of the pipeline will
# return exit code 1 if any of the markdown files do not contain a
# misspelled word
pandoc --lua-filter spellcheck.lua output/manuscript.md | uniq | while read word; do grep -ion "\<$word\>" content/*.md; done || true | sort -h -t ":" -k 1b,1 -k2,2 > output/spelling-errors.txt
cat output/spelling-errors.txt
fi

Expand Down

0 comments on commit 311269d

Please sign in to comment.