Newer
Older
hashdiff / hashdiff
Nigel Stanger on 27 Nov 2020 426 bytes Added basic script
#!/usr/bin/env bash

# Compare two files by hash.
# Based on http://alanwsmith.com/command-line-one-liner-to-compare-files-with-md5

# Future enhancements:
# * different hashes
# * "paranoid" mode (use several different hashes)
# * compare more than two files
# * verbose: print out hashes if different

file1=$1
file2=$2

if [ $(md5 -q ${file1}) == $(md5 -q ${file2}) ]
then
    echo "identical"
else
    echo "different"
fi