Licence
Creative Commons License

This work by Stephane KATTOOR is licensed under a Creative Commons Attribution 3.0 Unported License.
Feeling like tipping ?
If you find this blog useful, you might consider sending a few bitcoins to support it : 1BTtsC3beGJ6ysd8DhrXjdo6jVw5WD9mvY
RSS
 
RSS Feed
Follow me !
Tech@Sakana on Facebook
Search this site

Newsletter

Get latest posts by email (No spam, only posts):

Enter your email address:

Delivered by FeedBurner

Categories
Monthly archives
July 2007
M T W T F S S
« Jun   Aug »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
Day: für den 12. July 2007
Zsh is cool : brace expansion - July 12, 2007 by Stephane Kattoor

Quoting the zshexpn man page :

 

An expression of the form {n1..n2}, where n1 and n2 are integers, is expanded to every number between n1 and n2, inclusive. If either number begins with a zero, all the resulting numbers will be padded with leading zeroes to that minimum width. If the numbers are in decreasing order the resulting sequence will also be in decreasing order.

Check out this :
spaghetti% for i in {8..11}; do echo $i; done
8
9
10
11
spaghetti%

and then this :
spaghetti% for i in {08..11}; do echo $i; done
08
09
10
11
spaghetti%

So much for the “while loops” with expr to increment a variable and “if” tests to add the padding zeroes :-)

Who am I ?
Ads