Results 1 to 2 of 2
I would like to compare two md5sum outputs to see if the files match.
in my script I have
Code:
ORG_FILE="/path/to/org/file.zip"
NEW_FILE="path/to/new/file.zip"
MD5_ORIG=$(md5sum -b "$ORG_FILE")
MD5_NEW=$(md5sum -b "$NEW_FILE")
this gives ...
- 11-05-2010 #1
BASH md5sum compare
I would like to compare two md5sum outputs to see if the files match.
in my script I have
this gives me lines likeCode:ORG_FILE="/path/to/org/file.zip" NEW_FILE="path/to/new/file.zip" MD5_ORIG=$(md5sum -b "$ORG_FILE") MD5_NEW=$(md5sum -b "$NEW_FILE")
MD5_ORIG='dd3e19b2d1ec5f9b459238842ef560c7 */path/to/org/file.zip'
MD5_NEW='dd3e19b2d1ec5f9b459238842ef560c7 */path/to/new/file.zip'
How do I get just the MD5 hash and not the */.... stuff so I can compare them.
i tried
but All I get isCode:JUST_HASH=${$MD5_ORIG:0:32}
dir_mon_notify.sh: line 79: ${$MD5_ORIG:0:32}: bad substitution
Thanks for any help.
C
- 11-05-2010 #2
This might do
Note:Code:diff <(md5sum /path/to/org/file.zip| awk '{print $1}') <(md5sum path/to/new/file.zip | awk '{print $1}')
If either old or new file stays static, you only need to compute the md5sum once and save it into a file.
md5sum can then use that file to compare against a new run.You must always face the curtain with a bow.


Reply With Quote