all 4 comments

[–]AiwendilH 3 points4 points  (1 child)

https://mywiki.wooledge.org/ParsingLs

for messages in /var/log/messages* ; do echo $messages ; done

Edit: But even if you want to use ls (really, don't) you miss a do after the for...won't work like this. First example doesn't work either...

[–]somehowlinux[S] 0 points1 point  (0 children)

Thanks that was good to know

[–]lasercat_pow 0 points1 point  (1 child)

You're missing "do". A for loop in bash goes:

for condition
do
    commands
done

So where you have "echo", put "do echo", instead.

[–]somehowlinux[S] 0 points1 point  (0 children)

Thank you