simple one-liner for mass md5-summing

Andy Jack f.e.jack-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Mon Jun 14 16:10:48 UTC 2004


On Mon, Jun 14, 2004 at 11:48:20AM -0400, daniel wrote:
> i've got a directory of about 20 files that i'd like to run an md5 sum on each 
> and put the result into a file, so something like this:
> 
> md5sum file01.tar.gz > file01.tar.gz.md5
> 
> but x20.  anyone have a simple oneliner i can use for this?  everything's in 
> the same directory if that helps.

under bash:

for F in file*.tar.gz do; md5sum $F > $F.md5; done

bash is smart enough to build the script as you go, i.e.:

$ for F in file*.tar.gz <enter>
> do <enter>
> md5sum $F > $F.md5 <enter>
> done <enter>
[[bash runs]]

the ">" character above doesn't mean an email quote but it's the
"secondary" bash prompt which is bash's way of telling you that you're
not done giving it a command to process.

HTH,
Andy
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list