Reputation: 13
I'm able to run serially but unable to run it parallely. My code is as below:
#!/bin/bash
while :
do
for i in `find ~/Mainstore-1/ -maxdepth 1 -type f`
do
md5sum $i
done
sleep 1
done
Upvotes: 1
Views: 60
Reputation: 158250
This should do:
find ~/Mainstore-1/ -maxdepth 1 -type f -print0 | while read -d '' -r file ; do
# launch md5sum in background using `&`
md5sum "$file" &
done
# Wait for workers to finish
wait
Upvotes: 2