1. 命令执行顺序:
- Keywords (such as if, while, until)
- Aliases (see typeset –f)
- Built-in commands
- Functions
- Scripts and executables
- Brace expansion
- Tilde expansion
- Parameter expansion
- Variable substitution
- Command substitution
- Arithmetic expansion
- Word splitting
- Pathname expansion
3. 命令行分解顺序:
- History substitution is performed (if applicable).
- Command line is broken up into tokens, or words.
- History is updated (if applicable).
- Quotes are processed.
- Alias substitution and functions are defined (if applicable).
- Redirection, background, and pipes are set up.
- Variable substitution ($user, $name, etc.) is performed.
- Command substitution (echo "Today is `date`") is performed.
- Filename substitution, called globbing (cat abc.??, rm *.c, etc.) is performed.
- Command is executed.