Last active
October 31, 2022 05:00
-
-
Save iexa/a9f15c59321dee9a5ad23f6c5eadc1d1 to your computer and use it in GitHub Desktop.
Test a QuickSFV file on OSX with md5 and pv for progress-bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# use cat md5-file | ./test-md5.sh | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
if [[ $line = *";"* ]]; then | |
continue | |
fi | |
path=${line#* \*} | |
path=${path%$'\r'} | |
path=${path/\\//} | |
expected=${line% *} | |
# calculated=$(md5 -q $path) | |
calculated=$(pv -- $path | md5 | sed 's/-$//' | printf '%s%s\n' "$(cat -)") | |
if [ "$expected" = "$calculated" ]; then | |
echo "$path: ✔" | |
else | |
echo "$path: ✖ $expected|$calculated" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
install pv with (home)brew first