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 

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.