Brace Expansion

Brace expansion is a convenient feature that allows you to generate lists of items quickly on the command line.

A string of the form str{xx,yy,zz}ing is expanded to the individual words strxxing stryying strzzing on the command line. Left-to-right order is preserved.

Example:

  > ls -l array{5d,MYd,BIG}
  -rw-r--r--   1 l-schro    stdt             0 Apr 19 17:16 array5d
  -rw-r--r--   1 l-schro    stdt             0 Apr 19 17:16 arrayBIG
  -rw-r--r--   1 l-schro    stdt             0 Apr 19 17:16 arrayMYd
  

An expression of the form {n1..n2} where n1 and n2 are integers evaluates to a list of numbers from n1 to n2. If either number starts with a zero, all numbers are padded with leading zeroes to the minimum width.

Example:

  > touch logfile.9908{01..31}.tmp
  > ls logfile*
  logfile.990301.tmp  logfile.990309.tmp  logfile.990317.tmp ogfile.990325.tmp
  logfile.990302.tmp  logfile.990310.tmp  logfile.990318.tmp ogfile.990326.tmp
  logfile.990303.tmp  logfile.990311.tmp  logfile.990319.tmp ogfile.990327.tmp
  logfile.990304.tmp  logfile.990312.tmp  logfile.990320.tmp ogfile.990328.tmp
  logfile.990305.tmp  logfile.990313.tmp  logfile.990321.tmp ogfile.990329.tmp
  logfile.990306.tmp  logfile.990314.tmp  logfile.990322.tmp ogfile.990330.tmp
  logfile.990307.tmp  logfile.990315.tmp  logfile.990323.tmp ogfile.990331.tmp
  logfile.990308.tmp  logfile.990316.tmp  logfile.990324.tmp