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)

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Powered by pmwiki-2.2.0-beta65