Created
July 12, 2018 17:40
-
-
Save mcmire/1ffc1e369397be33184fef9cebf2081f to your computer and use it in GitHub Desktop.
Calculate a checksum of multiple directories
This file contains 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 | |
set -euo pipefail | |
uname=$(uname) | |
checksum() { | |
if [[ $uname == 'Darwin' ]]; then | |
md5 -r | |
else | |
md5sum | |
fi | |
} | |
find "$@" | LC_ALL=C sort | tar -cf - -T - --no-recursion | checksum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment