Definition
Shell expansion is the set of textual transformations bash performs on a command line after parsing but before executing the resulting program. There are eight expansion phases, applied in a fixed order: brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, process substitution, word splitting, and pathname expansion. Each phase rewrites parts of the line; the final list of words is what the kernel actually executes.
Understanding the ordering is what separates users who guess at the shell from those who can predict its behaviour. Brace expansion happens first and is purely textual, so it cannot reference variable values. Pathname expansion happens last, so a glob can match files whose names came from a substitution earlier in the pipeline.
Why it matters
How it works
The shell tokenises the input line into words, then walks the expansion phases in order. Brace expansion produces literal strings from patterns like {a,b,c} or {1..10} — useful for generating sequences before any variable lookup. Tilde expansion converts a leading ~ into the user home directory. Parameter expansion substitutes the value of a variable; command substitution runs a subshell and inserts its standard output; arithmetic expansion evaluates an integer expression. Process substitution exposes a command's output as a temporary file path. Word splitting then breaks unquoted results on whitespace using the IFS variable, and pathname expansion finally interprets any wildcard characters that remain.
Quoting is the operator's lever on this pipeline. Single quotes disable every phase except brace ordering of the literal text itself. Double quotes permit parameter, command, and arithmetic expansion but suppress word splitting and pathname expansion. No quotes lets every phase run, which is the source of nearly every accidental file expansion or word-split bug. Predicting what bash will do reduces to running the expansion phases in your head and watching where each transformation lands.