沙盒:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Jinzd留言 | 贡献
无编辑摘要
Jinzd留言 | 贡献
无编辑摘要
第4行: 第4行:


# Reads its input from a file (see [[#Shell Scripts|Shell Scripts]]), from a string supplied as an argument to the -c invocation option (see [[#Invoking Bash|Invoking Bash]]), or from the user’s terminal.  
# Reads its input from a file (see [[#Shell Scripts|Shell Scripts]]), from a string supplied as an argument to the -c invocation option (see [[#Invoking Bash|Invoking Bash]]), or from the user’s terminal.  
# Breaks the input into words and operators, obeying the quoting rules described in [[#Quoting|Quoting]]. These tokens are separated by metacharacters. Alias expansion is performed by this step (see Aliases).  
# Breaks the input into words and operators, obeying the quoting rules described in [[#Quoting|Quoting]]. These tokens are separated by metacharacters. Alias expansion is performed by this step (see [[#Aliases|Aliases]]).  
# Parses the tokens into simple and compound commands (see Shell Commands).  
# Parses the tokens into simple and compound commands (see [[#Shell Commands|Shell Commands]]).  
# Performs the various shell expansions (see Shell Expansions), breaking the expanded tokens into lists of filenames (see Filename Expansion) and commands and arguments.  
# Performs the various shell expansions (see Shell Expansions), breaking the expanded tokens into lists of filenames (see Filename Expansion) and commands and arguments.  
# Performs any necessary redirections (see Redirections) and removes the redirection operators and their operands from the argument list.  
# Performs any necessary redirections (see Redirections) and removes the redirection operators and their operands from the argument list.  
# Executes the command (see Executing Commands).  
# Executes the command (see Executing Commands).  
# Optionally waits for the command to complete and collects its exit status (see Exit Status).
# Optionally waits for the command to complete and collects its exit status (see Exit Status).

2016年6月28日 (二) 17:53的版本

3.1.1 Shell Operation

The following is a brief description of the shell’s operation when it reads and executes a command. Basically, the shell does the following:

  1. Reads its input from a file (see Shell Scripts), from a string supplied as an argument to the -c invocation option (see Invoking Bash), or from the user’s terminal.
  2. Breaks the input into words and operators, obeying the quoting rules described in Quoting. These tokens are separated by metacharacters. Alias expansion is performed by this step (see Aliases).
  3. Parses the tokens into simple and compound commands (see Shell Commands).
  4. Performs the various shell expansions (see Shell Expansions), breaking the expanded tokens into lists of filenames (see Filename Expansion) and commands and arguments.
  5. Performs any necessary redirections (see Redirections) and removes the redirection operators and their operands from the argument list.
  6. Executes the command (see Executing Commands).
  7. Optionally waits for the command to complete and collects its exit status (see Exit Status).