Check for correct number of arguments.

Otherwise, print some usage info.
This commit is contained in:
Cory Boyd 2016-02-07 14:06:55 -08:00
parent 7d25a9fc30
commit c1a691d965

View file

@ -1,5 +1,10 @@
#!/usr/bin/env bash
if [ $# -ne 2 ]; then
>&2 echo "Usage: $0 <author> <commit>"
exit 1
fi
AUTHOR=$1
AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1')
AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1')