Here’s the code:
#!/bin/bash
cmd=$@
if echo $cmd | grep '/$'
then
xargs -rd '\n' -I {} $cmd{}
else
xargs -rd '\n' -I {} $cmd {}
fi
Usage is like:
ls *zip | iter shasum
or
ls *zip | iter shasum ../zipfile_archive/
The second one would get the shasum of zip files that have the same name as ones in the cwd
This assumes, of course, that the input files have sane names, ie, no spaces, etc
Very nice; I will use this. Thanks!