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, variable, and 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 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 3.4.2 Special Parameters) and "$" (see section 6.7 Arrays).
After all expansions, quote removal (see section 3.5.9 Quote Removal) is performed.
--------------------------------------------------------------------------------
[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
3.5.1 Brace Expansion
Brace expansion is a mechanism by which arbitrary strings may be generated. This mechanism is similar to filename expansion (see section 3.5.8 Filename Expansion), but the file names generated need not exist. Patterns to be brace expanded take the form of an optional preamble, followed by a series of comma-separated strings between a pair of braces, followed by an optional postscript. The preamble is prefixed to each string contained within the braces, and the postscript is then appended to each resulting string, expanding left to right.
Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, bash$ echo ae
ade ace abe
Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved in the result. It is strictly textual. Bash does not apply any syntactic interpretation to the context of the expansion or the text between the braces. To avoid conflicts with parameter expansion, the string `${' is not considered eligible for brace expansion.
A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma. Any incorrectly formed brace expansion is left unchanged.
This construct is typically used as shorthand when the common prefix of the strings to be generated is longer than in the above example: mkdir /usr/local/src/bash/
or chown root /usr/,lib
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




