Iterating over each line of ls -l output

Posted by Ivan on Stack Overflow See other posts from Stack Overflow or by Ivan
Published on 2010-05-18T18:24:24Z Indexed on 2010/05/18 18:40 UTC
Read the original article Hit count: 267

Filed under:
|
|

I want to iterate over each line in the output of ls -l /some/dir/* Right now I'm trying: for x in ls -l $1; do echo $x done, however this iterates over each element in the line seperately, so i get

-r--r-----
1
ivanevf
eng
1074
Apr
22
13:07
File1

-r--r-----
1
ivanevf
eng
1074
Apr
22
13:17
File2

I want to iterate over each line as a whole, though.

How do I do that?

Thanks.

© Stack Overflow or respective owner

Related posts about shell

Related posts about shell-scripting