What is the name for `<(…)` 'operator' in bash?

后端 未结 2 964
忘掉有多难
忘掉有多难 2020-11-27 23:14

I\'m familiar with creating \'temporary files\' for command input in bash, e.g.

cat file_1 <(echo hello) file_2

I want to read more abou

相关标签:
2条回答
  • 2020-11-27 23:33

    This is called process substitution:

    Process substitution is a form of redirection where the input or output of a process (some sequence of commands) appear as a temporary file.

    Also from 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.

    0 讨论(0)
  • 2020-11-27 23:54

    Also known as 'anonymous FIFO'.

    0 讨论(0)
提交回复
热议问题