Shell – Silent result with two identical files in diff: how to show them

diff()file-comparisonshell-script

When I set the -s parameter, diff also print files, that are different.

diff -s $FIRST_FILE $SECOND_FILE

Best Answer

One possible solution may be:

diff -s $FIRST_FILE $SECOND_FILE > /dev/null
if [ $? -eq 0 ]; then
    echo "The files are identical"
fi

NOTE: It changed the question text.

Related Question