Created
September 1, 2025 05:22
-
-
Save skull-squadron/bb453a89da56d2b1474de03c185bf6b1 to your computer and use it in GitHub Desktop.
hash-checker - Generic recursive SHA256 creation and checking utility
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/sh | |
# shellcheck disable=2094 | |
set -eu | |
cd "$(dirname "$0")" || exit 1 | |
hash_file='hashes.txt' | |
case "${1-}" in | |
save) find . -type f -print0 ! -name "$hash_file" | sort -z | xargs -0 sha256sum | tee "$hash_file" ;; | |
check) sha256sum -c "$hash_file" ;; | |
*) | |
echo >&2 | |
echo >&2 "$(basename "$0"): usage: $0 {save|check}" | |
echo >&2 | |
echo >&2 | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment