I often forget about "cmp" and use "diff" when all I really want to know is if two files are the same:
cmp -s file1 file2 || echo "Not the same"
Often the reason for the comparison is that I've written something like this:
touch /tmp/testdirb.$$ while : do ls /testdir > /tmp/testdira.$$ cmp -s /tmp/testdira.$$ /tmp/testdirb.$$ || echo "changed" cp /tmp/testdira.$$ /tmp/testdirb.$$ sleep 300 done
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic
Inexpensive and informative Apple related e-books:
Take Control of Security for Mac Users
Take Control of Apple Mail, Third Edition
Take Control of the Mac Command Line with Terminal, Second Edition
Take Control of Pages
Take Control of Upgrading to Sierra