Xargs
Pass parameter
ls *.tar.gz | xargs -I{} gpg -c {}
# with a pipeline
find . -type d -name '*log*' | xargs -I {} sh -c "echo {}; ls -ltr {} | tail -2"
Run the command in parallel
xargs -P <n_proc>
ls *.tar.gz | xargs -I{} gpg -c {}
# with a pipeline
find . -type d -name '*log*' | xargs -I {} sh -c "echo {}; ls -ltr {} | tail -2"
xargs -P <n_proc>