[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.5 Shell Expansions
Expansion is performed on the command line after it has been split into
token
s. There are seven kinds of expansion performed:
- brace expansion
- tilde expansion
- parameter and variable expansion
- command substitution
- arithmetic expansion
- word splitting
- filename expansion
3.5.1 Brace Expansion | Expansion of expressions within braces. | |
3.5.2 Tilde Expansion | Expansion of the ~ character. | |
3.5.3 Shell Parameter Expansion | How Bash expands variables to their values. | |
3.5.4 Command Substitution | Using the output of a command as an argument. | |
3.5.5 Arithmetic Expansion | How to use arithmetic in shell expansions. | |
3.5.6 Process Substitution | A way to write and read to and from a command. | |
3.5.7 Word Splitting | How the results of expansion are split into separate arguments. | |
3.5.8 Filename Expansion | A shorthand for specifying filenames matching patterns. | |
3.5.9 Quote Removal | How and when quote characters are removed from words. |
The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting; and filename expansion.
On systems that can support it, there is an additional expansion available: process substitution. This is performed at the same time as tilde, parameter, variable, and arithmetic expansion and command substitution.
Only brace expansion, word splitting, and filename expansion
can change the number of words of the expansion; other expansions
expand a single word to a single word.
The only exceptions to this are the expansions of
"$@"
(see section Special Parameters) and "${name[@]}"
(see section Arrays).
After all expansions, quote removal
(see section Quote Removal)
is performed.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on February 28, 2014 using texi2html 5.0.