个人工具

“沙盒”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
3.1.1 Shell Operation
+
3.1.2
  
The following is a brief description of the shell’s operation when it reads and executes a command. Basically, the shell does the following:  
+
* [[#Escape Character|Escape Character]]:    How to remove the special meaning from a single character. 
 +
* [[#Single Quotes|Single Quotes]]:    How to inhibit all interpretation of a sequence of characters.
 +
* [[#Double Quotes|Double Quotes]]:    How to suppress most of the interpretation of a sequence of characters. 
 +
* [[#ANSI-C Quoting|Double Quotes]]:   How to expand ANSI-C sequences in quoted strings. 
 +
* [[#Locale Translation|Locale Translation]]:    How to translate strings into different languages. 
  
以下是当shell读取或执行一个命令时所进行操作的的一个简要描述,shell将做以下事情:
+
Quoting is used to remove the special meaning of certain characters or words to the shell. Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion.
  
# 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.  
+
Each of the shell metacharacters (see Definitions) has special meaning to the shell and must be quoted if it is to represent itself. When the command history expansion facilities are being used (see History Interaction), the history expansion character, usually ‘!’, must be quoted to prevent history expansion. See Bash History Facilities, for more details concerning history expansion.  
#: 从文件读取它的输入(参看[[#Shell Scripts|Shell Scripts]]),从字符串参数以-c调用选项方式(参看[[#Invoking Bash|Invoking Bash]]),或者从用户终端。
+
 
# 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]]).  
+
There are three quoting mechanisms: the escape character, single quotes, and double quotes.
#: 断句,把相关的输入分解成words和操作符,它遵循[[#Quoting|Quoting]]中的引用规则。这些tokens会被元字符分开。别名扩展将按照[[#Aliases|Aliases]]步骤被执行。
+
# Parses the tokens into simple and compound commands (see [[#Shell Commands|Shell Commands]]).
+
#: 这些tokens将被解析为一些简单和复合的命令(参看[[#Shell Commands|Shell Commands]])。
+
# Performs the various shell expansions (see [[#Shell Expansions|Shell Expansions]]), breaking the expanded tokens into lists of filenames (see [[#Filename Expansion|Filename Expansion]]) and commands and arguments.  
+
#: 执行不同的shell扩展(参看[[#Shell Expansions|Shell Expansions]]),断句这些扩展的tokens为文件列表(参看[[#Filename Expansion|Filename Expansion]])命令及参数。
+
# Performs any necessary redirections (see [[#Redirections|Redirections]]) and removes the redirection operators and their operands from the argument list.
+
#: 执行任何必要的重定向(参看[[#Redirections|Redirections]])并且从参数列表中移除那些重定向操作符和它们的操作数。
+
# Executes the command (see [[#Executing Commands|Executing Commands]]).
+
#: 执行命令(参看[[#Executing Commands|Executing Commands]])。
+
# Optionally waits for the command to complete and collects its exit status (see [[#Exit Status|Exit Status]]).
+
#: 可选的,等待命令的完成并收集器退出状态(参看[[#Exit Status|Exit Status]])。
+

2016年7月4日 (一) 09:47的版本

3.1.2

  • Escape Character: How to remove the special meaning from a single character.
  • Single Quotes: How to inhibit all interpretation of a sequence of characters.
  • Double Quotes: How to suppress most of the interpretation of a sequence of characters.
  • Double Quotes: How to expand ANSI-C sequences in quoted strings.
  • Locale Translation: How to translate strings into different languages.

Quoting is used to remove the special meaning of certain characters or words to the shell. Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion.

Each of the shell metacharacters (see Definitions) has special meaning to the shell and must be quoted if it is to represent itself. When the command history expansion facilities are being used (see History Interaction), the history expansion character, usually ‘!’, must be quoted to prevent history expansion. See Bash History Facilities, for more details concerning history expansion.

There are three quoting mechanisms: the escape character, single quotes, and double quotes.