for file in *pdf *azw3; do calibre-convert $file $file.epub; done
vs find . -name \*pdf -o -name \*azw3 -print0 | xargs -I {} calibre-convert {} {}.epub
Something about the former is more natural for my brain to produce. If I want to parallelize, for shell loops my muscle memory very quickly converts the above to for file in *pdf *azw3; do calibre-convert $file $file.epub & done; wait
... but if I have a million files my machine is going to have a bad day, whereas the xargs version is easy to limit to N parallel invocations.I'd really like a shell that lets me define my own sugared versions of shell grammar. I imagine writing a 'forp' that would let me do
forp $(nproc) file in ...; do ...; done
and the shell would run up to $(nproc) invocations in parallel. Anybody know of such a shell? (Don't say eshell.)