commit 5a7add0577ace67c72cf4f3e503e3f3fe9c5a1fb parent 48fa57204ab30e327c582b3590b71b72ec1db46e Author: William Casarin <bill@casarin.me> Date: Mon, 22 Feb 2016 16:40:56 -0800 error handling Diffstat:
M | hashname | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/hashname b/hashname @@ -1,5 +1,12 @@ #!/usr/bin/env bash +usage() { + echo "hashname <filename>" + exit 1 +} + +[[ -z "$1" ]] && usage + hash=$(sha1sum "$1" | awk '{ print $1 }') hashlen=${2:-16} shorthash=${hash:0:$hashlen}