bash: Brace Expansion

1 
1 3.5.1 Brace Expansion
1 ---------------------
1 
1 Brace expansion is a mechanism by which arbitrary strings may be
11 generated.  This mechanism is similar to FILENAME EXPANSION (⇒
 Filename Expansion), but the filenames generated need not exist.
1 Patterns to be brace expanded take the form of an optional PREAMBLE,
1 followed by either a series of comma-separated strings or a sequence
1 expression between a pair of braces, followed by an optional POSTSCRIPT.
1 The preamble is prefixed to each string contained within the braces, and
1 the postscript is then appended to each resulting string, expanding left
1 to right.
1 
1    Brace expansions may be nested.  The results of each expanded string
1 are not sorted; left to right order is preserved.  For example,
1      bash$ echo a{d,c,b}e
1      ade ace abe
1 
1    A sequence expression takes the form '{X..Y[..INCR]}', where X and Y
1 are either integers or single characters, and INCR, an optional
1 increment, is an integer.  When integers are supplied, the expression
1 expands to each number between X and Y, inclusive.  Supplied integers
1 may be prefixed with '0' to force each term to have the same width.
1 When either X or Y begins with a zero, the shell attempts to force all
1 generated terms to contain the same number of digits, zero-padding where
1 necessary.  When characters are supplied, the expression expands to each
1 character lexicographically between X and Y, inclusive, using the
1 default C locale.  Note that both X and Y must be of the same type.
1 When the increment is supplied, it is used as the difference between
1 each term.  The default increment is 1 or -1 as appropriate.
1 
1    Brace expansion is performed before any other expansions, and any
1 characters special to other expansions are preserved in the result.  It
1 is strictly textual.  Bash does not apply any syntactic interpretation
1 to the context of the expansion or the text between the braces.  To
1 avoid conflicts with parameter expansion, the string '${' is not
1 considered eligible for brace expansion.
1 
1    A correctly-formed brace expansion must contain unquoted opening and
1 closing braces, and at least one unquoted comma or a valid sequence
1 expression.  Any incorrectly formed brace expansion is left unchanged.
1 
1    A { or ',' may be quoted with a backslash to prevent its being
1 considered part of a brace expression.  To avoid conflicts with
1 parameter expansion, the string '${' is not considered eligible for
1 brace expansion.
1 
1    This construct is typically used as shorthand when the common prefix
1 of the strings to be generated is longer than in the above example:
1      mkdir /usr/local/src/bash/{old,new,dist,bugs}
1    or
1      chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
1