I know I can do this...
if diff -q $f1 $f2
then
echo "they're the same"
else
echo "they're different"
fi
But what if I want to negate the condition that I'm checking? i.e. something like this (which obviously doesn't work)
if not diff -q $f1 $f2
then
echo "they're different"
else
echo "they're the same"
fi
I could do something like this...
diff -q $f1 $f2
if [[ $? > 0 ]]
then
echo "they're different"
else
echo "they're the same"
fi
Where I check whether the exit status of the previous command is greater than 0. But this feels a bit awkward. Is there a more idiomatic way to do this?