Re: need help making shell script use two CPUs/cores
> unfortunately that simple approach is harder to do with my renaming
> scheme. So I would probably write a helper script that did the
> options to convert and renamed the file and so forth.
> for k in *.JPG; do
> base=$(basename $k .JPG)
> test -f $base.1024.jpg && continue # skip if already done
> echo $k;
> done | xargs -L1 -P4 echo my-convert-helper
> And my-convert-helper could take the argument and apply the options in
> the order needed and so forth.
If you want to use the renaming form of the command (which I also tend
to prefer), then I think that using a Makefile makes a lot of sense (and
GNU make's -j argument lets you specify parallel behavior).
Stefan
Reply to: