\ Quote the next metacharacter
[] Character class
{} Multiple pattern
* Match any string of characters
? Match any single character
~ User name home directory
The metanotation a{b,c,d}e is a shorthand for abe ace ade. Left to rig
+ht order is preserved, with results of matches being sorted separatel
+y at a low level to preserve this order. As a special case {, }, and
+{} are passed undisturbed.
blokhead (ab)uses this pattern-description language by replacing each '-' with {1, 0} to give that placeholder a possible value of 1 OR 0. glob("1{1,0}1") will happily expand to 111 and 101, since unless you include a wildcard character (* or ?) or a character class in your pattern it will NOT go to the filesystem to give you back the list of files but rather expands immediately to all possible values which are allowed by the pattern. It seems to be a (useful) side-effect of the pre-filesystem lookup pre-processing of the pattern to expand {pat,pat,...} strings. Updated: as per tye's comments
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|