Piping the output of a loop to a Linux command