Reputation: 10064
On several occasions I want to use xargs generated arguments and use them in an elaborated command pipeline (piping the results through several steps and using).
I typically end up using a bash -c with xargs-generated-argument as only argument. E.g:
find *.obj | xargs -I{} bash -c 'sha256sum $0 | tee $0.sha256' {}
Is there any better or more concise way to do this?
Upvotes: 1
Views: 124
Reputation: 207465
I think it is more concise with GNU Parallel as follows:
find "*.obj" -print0 | parallel -0 sha256sum {} \| tee {}.sha256
In addition, it is:
parallel --dry-run ...
--bar
or --eta
to get a progress bar or ETA for completion{.}
meaning the current file minus its extension, {/}
meaning "base name" of current file, {//}
meaning directory of current file and so onUpvotes: 2