Comparing two files for a difference
If you have file1 and file2 and you want to know where they differ, you can use the following if statement.
if ! diff file1 file2 >> /dev/null; then echo "they differ" else echo "they don't differ" fi
If you have file1 and file2 and you want to know where they differ, you can use the following if statement.
if ! diff file1 file2 >> /dev/null; then echo "they differ" else echo "they don't differ" fi