Apply command to each line

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-04-26T03:31:30Z Indexed on 2010/04/26 3:33 UTC
Read the original article Hit count: 199

Filed under:

Suppose I have some output from a command (such as ls -1):

a
b
c
d
e
...

I want to apply a command (say echo to each one, in turn). E.g.

echo a
echo b
echo c
echo d
echo e
...

What's the easiest way to do that in bash?

© Stack Overflow or respective owner

Related posts about bash