summaryrefslogtreecommitdiff
path: root/misc/verify
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2023-09-09 09:45:17 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2023-09-09 09:45:17 -0500
commit7e702328744b294bd35d4377c09c15270059ebea (patch)
tree4927f40d215a353f3042835b67ba80eb514bf3e9 /misc/verify
parentfe1c46593907cb135c0ab75abafb1f0f36c5625f (diff)
downloadscripts-7e702328744b294bd35d4377c09c15270059ebea.tar.xz
scripts-7e702328744b294bd35d4377c09c15270059ebea.zip
cleanup a bit
Diffstat (limited to 'misc/verify')
-rwxr-xr-xmisc/verify27
1 files changed, 15 insertions, 12 deletions
diff --git a/misc/verify b/misc/verify
index 40ef0b4..1af694a 100755
--- a/misc/verify
+++ b/misc/verify
@@ -7,6 +7,7 @@ RED="\033[0;31m"
me="$(basename "$0")"
concat="pv -EE -F%r_[%b]_[%t]_[%e]_%p"
+crypt=xxh
printhelp() {
cat << HELPDOC
@@ -14,6 +15,7 @@ Usage: $me [options] [file/directory]...
OPTIONS:
-o, --stdout Output checksum to STDOUT
+ -d, --compare Output checksum to STDOUT while displaying the progress
-S, --supress Supress all warnings and progress notes (default with -o)
-n, --no-progress Don't output progress bar (default with -o & -S)
-m, --md5 Create/verify md5 checksum
@@ -25,20 +27,20 @@ OPTIONS:
HELPDOC
}
-crypt=xxh
while true; do
case "$1" in
- -o|--stdout) stdout=1; nowarn=1; concat="cat" ;;
- -S|--supress) nowarn=1; concat="cat" ;;
- -n|--no-progressbar) concat="cat" ;;
- -m|--md5) crypt=md5 ;;
- -s*|--sha*) crypt=sha$(echo "$1" | tr -cd [:digit:]) ;;
- -x*|--xxh*) crypt=xxh$(echo "$1" | tr -cd [:digit:]) ;;
- -c|--crypt) crypt=$2 && shift ;; # Shift twice
- -v|--verify) verify=1 ;;
- -h|--help) printhelp; exit 0 ;;
- -*) printhelp; exit 2 ;;
- *) break ;;
+ -o|--stdout) stdout=1; nowarn=1; concat="cat" ;;
+ -d|--compare) stdout=1; nowarn=1; ;;
+ -S|--supress) nowarn=1; concat="cat" ;;
+ -n|--no-progressbar) concat="cat" ;;
+ -m|--md5) crypt=md5 ;;
+ -s*|--sha*) crypt=sha$(echo "$1" | tr -cd [:digit:]) ;;
+ -x*|--xxh*) crypt=xxh$(echo "$1" | tr -cd [:digit:]) ;;
+ -c|--crypt) crypt=$2 && shift ;; # Shift twice
+ -v|--verify) verify=1 ;;
+ -h|--help) printhelp; exit 0 ;;
+ -*) printhelp; exit 2 ;;
+ *) break ;;
esac
shift
done
@@ -52,6 +54,7 @@ if [ ! "$nowarn" ]; then
done
fi
+# TODO Remove trailing / from args
while [ -n "$1" ]; do
file="$1"
[ ! "`echo "$file" | sed "s/.$crypt$//"`" = "$file" ] && shift && continue # Skip hash files