Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
For text files, you can try with diff:
If the files are the same, nothing will be displayed. If they differ, it will throw out the differences.
if [ -z "$(diff -q file1 file2)" ]; then
echo "Одинаковые"
else
echo "Они такие разные!"
fi
cmp
: it compares files byte by byte and exits with status 0 if the files are identical; 1 if different; 2 if an error occurred. You can use it like this in a script:if cmp -s file1 file2 ; then
echo "Одинаковые"
else
echo "Они такие разные!"
fi
a=$(md5sum $file_a | awk '{print $1}')
b=$(md5sum $file_b | awk '{print $1}')
if ; then
echo "no change"
else
echo "files are different"
fi
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question