Software >> OS >> Unix >> Solaris >> How to use file comparison in an if-then-else-fi block

if cmp file1 file2; then

    echo "files are the same"

else

    echo "files are different

fi

Note:

cmp file1 file2 will return TRUE if they are idential and FALSE otherwise