Nice script coastie! Here's a couple suggestions to get your md5 checksums working:
coastie wrote:
Code:
wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalugslax.iso
clear
#md5sum usalugslax.iso > usalug.txt
#read usalug.txt md5
wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/usalug.mo
#clear
wget http://members:usalug@www.usalug.org/ISOS/coastie-slax/md5sum.txt
clear
#read md5sum.txt answer
if [[ `md5sum -c md5sum.txt` == 0 ]]
then echo "The md5sums match"; else echo "The md5sums don't
match...exiting" && exit 1
fi
If you have the md5sum.txt file that was generated by md5sum for a set of files, you simply need to run the md5sum utility with the -c option and it'll look at the md5sum.txt file and check the file names in it against the files in the current directory and then calculate the md5 for each matching file and compare it against the value in the md5sum.txt file. *whew*
Said another way if your md5sum.txt file looks like:
Code:
abcdef0123456789 foo.txt
0123456789abcdef bar.txt
when you run
Code:
md5sum -c md5sum.txt
it'll check the current directory for foo.txt and bar.txt. It will then calculate the md5 hash for each file and compare those hashes against the hashes in the md5sum.txt file associated with the corresponding file name. If a file is missing or changed, the md5sum check will fail with an exit status of 1.
That way you don't have to calculate the md5 sum of each file yourself and then parse through the md5sum.txt file to find the right hash value to compare your cacluated value against.