Recursão + mal:
repiper() {
local -i n="$1";
shift;
if (( n )); then
eval "$@" | repiper $((n-1)) "$@";
else
eval "$@";
fi
}
$ grep -lRF function dev/jquery/build | repiper 3 xargs -n1 dirname | head
.
.
dev
dev
dev
dev
$ grep -lRF function dev/jquery/build | repiper 1 xargs -n1 dirname | head
dev/jquery
dev/jquery
dev/jquery/build
dev/jquery/build
dev/jquery/build
dev/jquery/build
$ grep -lRF function dev/jquery/build | repiper 0 xargs -n1 dirname | head
dev/jquery/build
dev/jquery/build
dev/jquery/build/tasks
dev/jquery/build/tasks
dev/jquery/build/tasks
dev/jquery/build/tasks