I have 2 files test.txt and test.txt.md5. I would like to verify the checksum of test.txt.
The gnu tool md5sum requires an md5 file with the following format "[md5-hash][space][space][filename]" (md5sum -c test.txt.md5). Unfortunately my test.txt.md5 only contains the md5 hash (without the spaces and filename).
How can I pass the hash from the "test.txt.md5" file to the "md5sum -c" command? I guess I have to use the standard input however all examples I have seen try to recreate the md5sum file format
The content of the files is:
test.txt
:
test
and test.txt.md5
:
d8e8fca2dc0f896fd7cb4cb0031ba249
cmp test.txt.md5 <(md5sum test.txt | awk '{print $1}') && echo $?
If the result returned is0
then there is a match