Questions tagged [process-substitution]

Process substitution a form of inter-process communication that allows the input or output of a command to appear as a file (such as: `<(cmd)` or `>(cmd)`).

14 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
2answers
425 views

How to detect an error using process substitution

This question is similar to the following link, but focused on using the command line (bash shell). Using a simple example, when doing the following command: $ cat <(date); echo $? Fri Jul 7 21:...
2
votes
1answer
94 views

concurrent processing in bash using process expansion, and redirection

Apart from possible races that have to be controlled by using proper synchronisation, it's possible in bash to feed a data source concurrently into multiple pipelines and collect all their outputs ...
1
vote
0answers
24 views

How to use diff3 with text arguments instead of file paths?

I want to use diff3 with text arguments instead of file paths. For example, diff3 some_files/mine.txt some_files/older.txt ~/Downloads/yours.txt works as expected. However, I've been trying to achieve ...
1
vote
0answers
91 views

Using a here-doc with trailing backslashes inside a process substitution in bash

This: cat <<EOF one two three EOF Prints: one two three And this: cat <<EOF one \\ two \\ three EOF Prints: one \ two \ three But while this: cat <( cat <<EOF one two ...
1
vote
0answers
76 views

GPG error: “do_plaintext: wrote X bytes but expected Y bytes”

I'm having trouble using gpg when I use the <() syntax for process substitution. Here is a minimal-working example of my problem: $ gpg2 -c -o out.gpg <(head -c 73729 /dev/zero) gpg: ...
1
vote
0answers
178 views

process substitution with <(gunzip …) fails

The following code returns: syntax error near ( #!/bin/bash myprogram -i <(gunzip -c file.gz) -j <(gunzip -c file2.gz) It seems it doesn't like brackets. How can I make this script work? If I ...
1
vote
1answer
452 views

Bash Process Substitution in exec line, some commands stopped working

So I have a bash command using process substitution in an exec line that stopped working recently, and it boils down to this example: Contents of script.sh: #!/bin/bash ls -l "$1" >/tmp/out ...
0
votes
0answers
42 views

Process substitution doesn't work with diff and node

I'm trying to compare the output of my fizzbuzz.js program: for (let i = 1; i <= 100; i++) { let out = ""; if (i % 3 == 0) out += "Fizz"; if (i % 5 == 0) out += "Buzz"; if (i % 3 &&...
0
votes
1answer
15 views

Process substitution to script in order to monitor iotop

I am actively trying to get the output of the iotop for monitoring. As you know, the iotop is interactive, meaning that once started, it'll provide live updates on disk usage on the system. I'm ...
0
votes
0answers
50 views

Write stdout to a temp file using command line

Say for example we wanted to write the env from the host to Docker container, one way would be to use a temp file: env > env_file && docker run --env-file env_file image_name to avoid a ...
0
votes
0answers
49 views

How to pass to ssh the key stored in a shell environment variable?

Presumably ssh tries to access the fd several times, but the fd is destroyed after it has been read the very first time: # ssh -i <(echo $KEY) user@example.com Warning: Identity file /dev/fd/11 ...
0
votes
0answers
35 views

Process substitution of commands on separate lines of a string

I have a variable, COMMANDS, that contains a list of newline-separated commands (I know for example in this case that there will never be newlines, but they could be separated by NUL). For example, ...
0
votes
0answers
112 views

Bash Process Substitution Hangs When Listing Bindings

TLDR: cat <(INPUTRC=/dev/null bash -c 'bind -pm emacs') # freezes # I can't use this because I need to pipe the output of the bind cat <(INPUTRC=/dev/null bash -c 'bind -pm emacs' &) # ...
0
votes
1answer
343 views

Process substitution over ssh with sudo in Bash shell

What is the proper way to do something like this: diff <( ssh -t myuser@hosta 'sudo httpd -M') <(httpd -M) When I want to compare the output of the 2 commands, the first on a remote host the ...