diff --git a/_glyphs/compile.sh b/_glyphs/compile.sh index 5927ef53a60..e127434010e 100755 --- a/_glyphs/compile.sh +++ b/_glyphs/compile.sh @@ -30,5 +30,5 @@ fontcustom compile "${dir}" \ "--output=${target}" \ --font-name=icons --templates=css --no-hash --force --autowidth --debug -cat "${target}/icons.css" | sed -E "s|\"./icons([^\"]+)\"|\"https://www.yegor256.com/css/icons\1?$(date +%s)\"|g" > "${target}/icons.css" +sed -E "s|\"./icons([^\"]+)\"|\"https://www.yegor256.com/css/icons\1?$(date +%s)\"|g" < "${target}/icons.css" > "${target}/icons.css" diff --git a/_rake/ping.sh b/_rake/ping.sh index 5a3547e9915..045bb0860dd 100755 --- a/_rake/ping.sh +++ b/_rake/ping.sh @@ -34,7 +34,7 @@ function ping_uri { -H 'Accept-Encoding: gzip, deflate' \ -H 'Cache-Control: max-age=0' \ --retry 4 \ - --write-out '%{http_code} %{url_effective}\n' $1 + --write-out '%{http_code} %{url_effective}\n' "$1" } export -f ping_uri diff --git a/_rake/test_keywords.sh b/_rake/test_keywords.sh index fb23ad6285c..b97f7150e04 100755 --- a/_rake/test_keywords.sh +++ b/_rake/test_keywords.sh @@ -20,12 +20,12 @@ mkdir -p _temp rm -rf _temp/words.txt echo -n "fetching all words... " -for f in $(find _site -name '*.html'); do - tidy -i -asxml $f 2>/dev/null | \ +find _site -name '*.html' | while IFS= read -r f; do + tidy -i -asxml "${f}" 2>/dev/null | \ sed "s|>|>\n|g" | \ xmllint -html -xpath '(//article//p|//article//h2|//article//h3|//article//h4)/text()' - 2>/dev/null | \ sed "s/[^a-zA-Z]/ /g" | \ - tr A-Z a-z | \ + tr '[:upper:]' '[:lower:]' | \ sed 's/[ \t\n]/\n/g' | \ sed '/^[ \t]*$/d' >> _temp/words.txt done @@ -33,21 +33,20 @@ echo -e "done, $(wc -l _temp/words.txt | cut -f1 -d ' ') words found" rm -rf _temp/good-words.txt echo -n "removing stop words... " -cat _temp/words.txt | sort | uniq -c | sort -r | cut -c9- | \ -while read k; do - grep -q $k _travis/stop-words.txt - if [ $? -ne 0 ]; then - echo $k >> _temp/good-words.txt +sort < _temp/words.txt | uniq -c | sort -r | cut -c9- | \ +while read -r k; do + if ! grep -q "${k}" _travis/stop-words.txt; then + echo "${k}" >> _temp/good-words.txt fi done echo "done, $(wc -l _temp/good-words.txt | cut -f1 -d ' ') good words left" -cat _temp/good-words.txt | head -200 > _temp/top-words.txt +head -200 < _temp/good-words.txt > _temp/top-words.txt errors=0 -while read k; do +while read -r k; do echo -n "${k}: " - grep -q $k _temp/top-words.txt + grep -q "${k}" _temp/top-words.txt if [ $? -eq 1 ]; then echo "is absent!" ((errors++)) @@ -58,6 +57,6 @@ done < _travis/core-keywords.txt if [ "$errors" -ne "0" ]; then echo "there are ${errors} missed keywords, see above" cat _temp/top-words.txt - exit -1 + exit 1 fi