“for” loop in unix.

Leave a comment

May 9, 2013 by aubreykloppers

Some quick tips:

writing a quick string of numbers to a file:

# for i in {1..255}; do echo $i>>/file; done

the above will write 1 to 255 to file.

for i in {1..90}; do cp access.log.$i ..; done

the above will copy files from one dir to another (in my case an OLD dir used to store apache logfiles)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: