phd/scripts/check.sh

27 lines
870 B
Bash
Raw Normal View History

2019-10-10 12:03:42 +02:00
#!/usr/bin/env bash
errored=0
abstracts_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../src/abstracts/
for file in abstract-en.tex abstract-fr.tex; do
char=$(cat $abstracts_dir/$file | wc -m)
if [ $char -gt 4000 ]; then
errored=1
2019-10-10 14:57:44 +02:00
echo -e >&2 "\x1B[31;1merror:\x1B[0m $file has more than 4000 characters ($char characters)"
2019-10-10 12:03:42 +02:00
else
echo -e >&2 "\x1B[32;1msuccess:\x1B[0m $file passes the test ($char characters)"
fi
done
for file in abstract-simple-en.tex abstract-simple-fr.tex; do
char=$(cat $abstracts_dir/$file | wc -m)
if [ $char -gt 1000 ]; then
errored=1
2019-10-10 14:57:44 +02:00
echo -e >&2 "\x1B[31;1merror:\x1B[0m $file has more than 1000 characters ($char characters)"
2019-10-10 12:03:42 +02:00
else
echo -e >&2 "\x1B[32;1msuccess:\x1B[0m $file passes the test ($char characters)"
fi
done
exit $errored