Newer
Older
hashdiff / hashdiff
#!/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