As posted on Linux Format User Forums: Basically I was experimenting in shell script and was trying to create a useful script that took each file in the current directory (*.sh) and for each file, create a MD5 hash and save that hash in a file of the same name as the file (appended with a .md5 extension), so the basic script looked something like this:
*Code:* FILES="*.sh" for f in $FILES do md5sum $f > $f.md5 done Now, what is annoying is I have just run this at home on ubuntu (debian) and it has done the job as expected, however when I ran this on a test box at work today running CentOS (RedHat) it kept putting ALL the MD5 hashes in one file called "*.sh.md5", whereas what I was expecting, and what I got on Ubuntu, was say I had some files like so: *Code:* shellscript1.sh shellscript2.sh after I run my script above in the current directory, and then run an "ls" I should get: *Code:* shellscript1.sh shellscript1.sh.md5 shellscript2.sh shellscript2.sh.md5 Can anyone explain this deviant behaviour on Red Hat and give any tips that would allow the shellscript to work on either platform? Oh yes and if the code above is of any use you are welcome to it, and modify/redistribute as you see fit. It was a test really as I am learning "loops" at the moment and wondered if I could write a script that works with each file in a given folder. Regards Richard PS Sorry I haven't been to any LUG meetings for a while I will come back in the new year I promise. will there be one in December?
_______________________________________________ Peterboro mailing list [email protected] https://mailman.lug.org.uk/mailman/listinfo/peterboro
