summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/b29
1 files changed, 4 insertions, 5 deletions
diff --git a/bin/b2 b/bin/b2
index c24b318..07d1976 100755
--- a/bin/b2
+++ b/bin/b2
@@ -13,17 +13,17 @@ canonical_uri() {
 list=
 delete=
 hash=
-while getopts H:ldh opt; do
+while getopts Hldh opt; do
 	case "$opt" in
 	l) list=1 ;;
 	d) delete=1 ;;
-	H) hash=${OPTARG} ;;
+	H) hash=1 ;;
 	h | ?)
 		printf "usage: %s [-hld] [FILE] [DESTINATION]\n" "$(basename "$0")"
 		printf "\n"
 		printf "  -l       list\n"
 		printf "  -d       delete\n"
-		printf "  -H FILE  hash\n"
+		printf "  -H       hash as filename\n"
 		printf "\n"
 		printf "The default action is to put the FILE into the remote bucket\n"
 		exit 2
@@ -51,8 +51,7 @@ fi
 if [ -n "$hash" ]; then
 	ext="$(echo "${file}" | rev | cut -d\. -f1 | rev | sed -e "s#${file}##")"
 	[ -n "$ext" ] && ext=".${ext}"
-	[ "$hash" = "self" ] && hash=$file
-	sum=$(md5sum "$hash" | cut -d\  -f1)
+	sum=$(md5sum "$file" | cut -d\  -f1)
 	dest=$(echo "${dest}" | sed -e "s#$(basename "${file}")#${sum}${ext}#")
 fi