BASH for loop

user-pic
Vote 0 Votes

# Output 1 2 3...99
for i in {1..99}
do
   echo $i
done

for ((i=1;i<=99;i++))
do
   echo $i
done

for i in `seq 1 99`
do
   echo $i
done

# Output 1 3 5...99
for i in `seq 1 2 99`
do
   echo $i
done

# Output a to z
for i in {a..z}
do
   echo $i
done

1 Comment

| Leave a comment

try below:

echo {a..z}
不過1 3 5或要分行就不太一樣

還是說這是要筆記 bash loop的pattern :p

IKARi
ikari.ikari a.t. gmail

Leave a comment

Recent Comments

About this Entry

This page contains a single entry by Pank published on May 11, 2010 7:05 PM.

NetSetMan - Network Settings Manager was the previous entry in this blog.

Pure Windows Live Messenger Build 14.0.8117.416 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives