diff --git a/nextnumber b/nextnumber index f70ec50..8e87f8f 100755 --- a/nextnumber +++ b/nextnumber @@ -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 diff --git a/quicktest b/quicktest index 0654189..4eab80b 100755 --- a/quicktest +++ b/quicktest @@ -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