Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

md5sum validation for a file

I have two files hello.txt and hello.txt.md5

MD5 output is in the below format

cat hello.txt.md5 
b1946ac92492d2347c6235b4d2611184

I wrote a simple script to validate md5sum.

csum=$(cat hello.txt.md5)
echo "$csum hello.txt" | md5sum -c

This script works fine with Ubuntu 13.10 but it throws below error in Ubuntu 12.04.

md5sum: standard input: no properly formatted MD5 checksum lines found

Can anyone show me how to do this in Ubuntu12.04.

like image 282
Sasikiran Vaddi Avatar asked Feb 10 '23 17:02

Sasikiran Vaddi


1 Answers

At least on my md5sum files generated have two spaces between checksum and file name. Tested your script and it didn't work, added space between $csum and hello.txt and it did.

like image 110
Olli Mk Avatar answered Feb 23 '23 21:02

Olli Mk