On Wednesday 17 June 2009 19:24:50 Cathey, Jim wrote: > >for i in file > >do > > md5sum $i & > >done > > But "md5sum -c" processes its own file list, and returns a > status comprising all elements. Yes, it could be done in a > complicated shell script, but I figured it would be easier > and more generally usable if in C.
Not that complicated: cat list | while read EXPECTED FILE do ( [ md5sum -c $EXPECTED $FILE ] || touch failed & done wait rm failed 2>/dev/null || echo "it failed". > >But then you have those same problems with an > >internally forking version. > > Writes no problem, the parent would be doing all user I/O. The > order of checking could be a little different than a single-threaded > version, but that should surprise no one. For that particular use case it's irrelevant. When you say "threaded" here, are you talking -lpthread? Because you were talking about merely using fork before... > >On a semi-related note, it would be really nice if shells had some kind > > of > > >"jobs -w 0" option to wait until there are 0 background jobs running. > > They do: "wait" Coolness! It would be nice if shell builtins had man pages. Even synonym links pointing to the bash man page, ala gzip/gunzip/zcat... Rob -- Latency is more important than throughput. It's that simple. - Linus Torvalds _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
