changing long options with short options and K&R style

This commit is contained in:
Leo 2018-09-09 21:11:43 -06:00
commit a23f46249d
2 changed files with 6 additions and 8 deletions

View file

@ -1,16 +1,14 @@
#!/usr/bin/env bash
# TODO: Find a less trashy way to get the next available error code
if ! shopt -s globstar; then
if ! shopt -s globstar
then
echo "Error: This script depends on Bash 4." >&2
exit 1
fi
for i in 1 2; do
last=$(grep --no-filename --invert-match "^prop" ./**/*.hs \
| grep --extended-regexp --word-regexp --only-matching "$i[0-9]{3}" \
| sort --numeric-sort \
| tail --lines 1
)
for i in 1 2
do
last=$(grep -hv "^prop" ./**/*.hs | grep -Ewo "$i[0-9]{3}" | sort -n | tail -n 1)
echo "Next ${i}xxx: $((last+1))"
done

View file

@ -16,7 +16,7 @@ if [[ $var == *$'\nTrue'* ]]
then
exit 0
else
grep --context 3 --regexp "Fail" --regexp "Tracing" <<< "${var}"
grep -C 3 -e "Fail" -e "Tracing" <<< "${var}"
exit 1
fi
) 2>&1