LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MD5SUM With program (https://www.linuxquestions.org/questions/linux-newbie-8/md5sum-with-program-845166/)

vdz 11-18-2010 04:48 PM

MD5SUM With program
 
Hi All,

As I am asked to create a program that runs MD5SUM as follows:
  1. Run MD5 against a file and generate a checksum
  1. Because there are a lot of files in sequence number say file1, file2, etc. So everytime we run MD5 to check a file say file1 then it generates checksum1.md5, and file2 > checksum2.md5 and so on
I think it is possible but please help/show me where I start or somepoint to start with. I have done a bit of Unix before.

Thank you in advance

chrism01 11-18-2010 10:19 PM

The cmd is here http://linux.die.net/man/1/md5sum and bash docs here http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/

You'd need code similar to
Code:

for file in $( cat files.lst )
do
    md5sum $file >$file.md5
done

where the files to md5sum are listed one to a line in the file files.lst.
You can use the above links to amend the code to your spec.

vdz 11-19-2010 03:24 AM

Hi Chris

much appreciated.

I'll give it a go.

Cheers


All times are GMT -5. The time now is 08:56 PM.