gpt4 book ai didi

bash - bash 中 `<(...)` 'operator' 的名称是什么?

转载 作者:行者123 更新时间:2023-11-29 09:16:52 25 4
gpt4 key购买 nike

我熟悉为 bash 中的命令输入创建“临时文件”,例如

cat file_1 <(echo hello) file_2

我想阅读有关该主题的更多信息,但我不知道 <( ) 的名称运算符(operator)。我怀疑这是一种 IO 重定向。

这个符号/运算符有名称吗?

最佳答案

这叫做 process substitution :

Process substitution is a form of redirection where the input oroutput of a process (some sequence of commands) appear as a temporaryfile.

同样来自 Bash Reference Manual → 3.5.6 Process Substitution :

Process substitution allows a process’s input or output to be referred to using a filename. It takes the form of

<(list)

or

>(list)

The process list is run asynchronously, and its input or output appears as a filename. This filename is passed as an argument to the current command as the result of the expansion. If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list. Note that no space may appear between the < or > and the left parenthesis, otherwise the construct would be interpreted as a redirection. Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files.

When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic expansion.

关于bash - bash 中 `<(...)` 'operator' 的名称是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31703243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com