Friday, April 18, 2008

Bash Tip of the Day! for loops

Today's tip covers Bash for loops. A simple operation that comes in handy with nearly EVERY shell script.

for i in $(seq 1 10)
echo ${i}

Note that enclosing variables in curly braces is not required but will never let you down. Take the following code, for example:

echo $i # works
echo $i5 # won't work!
echo ${i}5 # works!

Enclosing the variable in curly braces allows you to use the variable anywhere, without fear of Bash interpreting surrounding characters as part of the variable.


Anonymous said...

I learned more about online money making system through your blog. I am having a nice blog about the same keyword when was I experienced about online making money through this blog.

Make Money Online

Free part Time Jobs

Part Time Jobs

Anonymous said...

I need to get more information from your blog and Can advice me to improve my blog to reach my goal.

How to create Blog

How to Make Money Online

Affiliate Programs