Bash doesn't have an easy way to
loop over input on a line by line basis. xargs and for loops still depend on IFS, which you certainly could reset. Or you
could use each():
each() {
local line=""
while read line; do
eval "${@/\{\}/\"${line}\"}" # $@ =~ s/ {} / $line /
done
}
That was updated for Rogan's comment on WhatAreShellsGoodFor and now handles spaces in filenames on input. So now you can do stuff like:
20990 ~> grep :0: /etc/passwd | grep -Eo '^[^:]+' | each echo rm -rf {}
rm -rf root
rm -rf sync
rm -rf shutdown
rm -rf halt
rm -rf operator