You probably want to do this instead.
echo "`diff $F1 $F2`"
diff $F1 $F2 > /dev/null 2>&1
rv=$?
...
because $?
is get set to 0 by the successful execution of echo
.
And if you don't want to run diff
twice you could do this too ..
diff $F1 $F2 > /tmp/thediff 2>&1
if [ $? != 0 ]
then
cat /tmp/thediff
fi