Next: , Up: Word Expansion


10.4.1 The Stages of Word Expansion

When word expansion is applied to a sequence of words, it performs the following transformations in the order shown here:

  1. Tilde expansion: Replacement of ‘~foo’ with the name of the home directory of ‘foo’.
  2. Next, three different transformations are applied in the same step, from left to right:
  3. Field splitting: subdivision of the text into words.
  4. Wildcard expansion: The replacement of a construct such as ‘*.c’ with a list of ‘.c’ file names. Wildcard expansion applies to an entire word at a time, and replaces that word with 0 or more file names that are themselves words.
  5. Quote removal: The deletion of string-quotes, now that they have done their job by inhibiting the above transformations when appropriate.

For the details of these transformations, and how to write the constructs that use them, see The BASH Manual (to appear).