balaji
balaji

Reputation: 1125

how to run more than one command one terminal?

i have to run "for" loop on linux terminal itself how i can do. ex.for i in cat ~/log;do grep -l "UnoRuby" $i >> ~/logName; done.

Upvotes: 0

Views: 668

Answers (2)

user unknown
user unknown

Reputation: 36229

You should prefer < instead of cat, and a more friendly format for the quesiton:

for i in $(< ~/log)
do
  grep -l "UnoRuby" $i >> ~/logName
done

Upvotes: 0

jcomeau_ictx
jcomeau_ictx

Reputation: 38412

Just as you typed it should be fine except: for i in $(cat ~/log); do grep -l "UnoRuby" $i >> ~/logName; done

Upvotes: 1

Related Questions