The first backquote not preceded by a backslash terminates the command substitution.
不带反斜杠的第一个后引号终止命令替换。
What we did above is called "command substitution".
上面所做的称为“命令替换”。
You saw an example of command substitution in Listing 9 when we created a captive TAB character.
我们曾经在清单9中创建了一个强制制表符,您可以从中看到命令替换的例子。
If you prefer, you can use the back-ticks for command substitution. It achieves the same result.
如果愿意,可以使用反撇号进行命令替换。
Command substitution is used at the command line, but more frequently in scripting; you will learn more about it and scripting in later articles of this series.
可以在命令行上使用命令替换,但在脚本中使用它则更常见;您将在本系列的后续文章中更多地了解它和脚本。
In Listing 9 we create a captive TAB character using command substitution and then create a very small shell script containing two cat commands, which each read from a here-document.
在清单9中,我们使用命令行替换创建了一个强制制表符,然后创建了一个包含两个cat命令的shell脚本,这两个命令都从here - document读取数据。
Those are not standard single quotes, but instead come from the keyboard key that normally sits above the Tab key. We can do exactly the same thing with bash's alternate command substitution syntax
那不是标准的单引号,而是键盘中通常位于 Tab键之上的单引号。
XSLT processors support the use of parameters at command invocation, allowing for dynamic substitution of parameter values in the extraction file.
XSLT处理器在命令调用的时候支持参数的使用,允许在提取文件中动态替换参数值。
It then generates a string containing the corresponding substitution command.
然后它产生一个包含相应替代命令的字符串。
Unlike bind variables, a substitution variable is processed on the client side, and its value will be substituted before submitting the command for execution.
不同于绑定变量,替代变量在客户端加以处理,且其值会在提交执行命令之前被替换。
This string is then written back into the timestamp line by the substitution command.
这个字符串然后被替代命令写回时间戳。
Note that our command is contained between double quotes (") so that substitution will occur for $ht.
注意,我们的命令被包含在双引号之间,因此将对 $ht 执行替换。
If you do this sort of thing often, you probably want to create a small shell script to automate this process just in case you have problems typing the Perl substitution command in the second line.
如果您经常做这类事情,可能想要创建一个小的shell脚本来自动化这一过程,以防在第二行键入替代的Perl命令时出问题。
Within most shell environments, you can use basic process substitution to embed the output of one command into the input or arguments of another.
在大多数Shell环境中,您都可以使用基本的进程替换来将一个命令的输出嵌入到另一个命令的输入或参数中。
Here the process substitution runs the directory listing components and returns a list of filenames, which is in turn supplied to the argument list of the emacs command.
这里的进程替换运行目录列表组件并返回一个文件名列表,后者又提供给emacs命令的参数列表。
The echo command, in turn, uses more substitution strings to report how many errors there were. Upon exiting the program, Purify sends a message similar to one
这个echo命令,相反利用更多的替代字符串来报告存在错误的数量。
It will not return an error to standard output if the file is not found. One way to test the return of the command is to use substitution, like shown in Listing 8.
即使找不到文件,它也不会向标准输出返回错误。
It will not return an error to standard output if the file is not found. One way to test the return of the command is to use substitution, like shown in Listing 8.
即使找不到文件,它也不会向标准输出返回错误。
应用推荐