First of all, glob expands the pattern according to shell
conventions, so
glob "foob{a,b,c}r"returns the list
('foobar', 'foobbr', 'foobcr')just like bash would return 'foobar foobbr foobcr' expandig metacharacters
The x operator applied to a string repeats the string the specified number of times, so
"{a,b,c}" x 3 evaluates as "{a,b,c}{a,b,c}{a,b,c}"
When you feed this expression to glob, the result is a list of all the possible combinations of a, b and c in a string of three characters, from 'aaa' to 'ccc'.
This could be easily achieved through magical string autoincrement, but the beauty of this method (very nice, I love it!) is that it applies to any set of strings to combine, not just characters.
-- TMTOWTDI
In reply to Re: Re: Web-Safe Color Chart
by trantor
in thread Web-Safe Color Chart
by Zecho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |