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)`).
189 questions
3 votes
1 answer
460 views
Understanding file descriptors and pipes resulting from `cat <(<command>)`
I don't understand the following: $ cat <(sleep 60) & jobs -l [1] 63813 [1]+ 63813 Running cat <(sleep 60) & /proc/63799/fd$ ps --forest PID TTY TIME CMD ...
1 vote
2 answers
653 views
Replace a string in a script without modifying the file, and then to execute it
I have both BSD (default) and GNU Awk implementations installed on a Mac (the latter is envoked using gawk instead of just awk), and I have a shell script with contents like this: awk -v maxLen=72 ' ...
1 vote
1 answer
172 views
Use Zsh process substitution in place of mktemp
If you have Pandoc installed, the following script will retrieve its HTML template, write it into a temporary file, make some adjustments, and then pass this file as a parameter: template=$(mktemp ...
0 votes
0 answers
269 views
diff -qr command between local and remote directories
According to this process substitution can be used to do a SIMPLE diff between local and remote machine. However, I want to use the -qr option in the diff command, i.e., it must be recursive and brief ...
0 votes
1 answer
103 views
ffmpeg inside while loop with find unintentionally alters iteration variable
Can someone please explain to me what is happening here? This is what I have reduced my situation down to: # make 20 test gifs out of the same source file. for i in {1..20}; do cp -p ../some-random-...
0 votes
0 answers
75 views
How to diff command outputs in vim
I tried vim -d <(ffprobe one.mp4 2>&1) <(ffprobe two.mp4 2>&1) to see the difference between the two videos' codecs etc., but vim doesn't show anything when it opens, just an empty ...
0 votes
0 answers
132 views
docker build inline command fails with process substitution part
I am wondering why this docker build command fails: docker build -t inline_img -f <(cat `FROM node:12` ) . [+] Building 0.1s (2/2) FINISHED => ERROR [internal] load build definition from 11 ...
1 vote
1 answer
542 views
Temporary symlink in shell - "named process substitution" - rename a file without creating a copy/symlink on the disk?
Thunderbird doesn't open files that don't have .eml extension as email files, but instead starts to compose a new message and adds them as attachments. To use thunderbird in scripts I'm looking for a ...
0 votes
0 answers
206 views
Redirect output to /dev/fd/x in POSIX script, where /dev/fd/x replaces process substitution
I have a would-be POSIX script that includes filtering the stderr output: exec <cmd> "$@" 2> >(grep -v "blih bluh blah") Redirection does not occur because process ...
1 vote
2 answers
189 views
process substitution to mimic file
I can't recall how to accomplish this, I am trying to support users to be able to include plaintext in their commands for temp usage: Here it reads from a file, file.json: lp_solve --method='simplex' -...
2 votes
1 answer
317 views
Order of fd allocation in process substitution
Inspired by this answer https://security.stackexchange.com/a/166645 I am wondering the reason behind the weird ordering when I run these commands: root@6cb8704148bf:/usr/app# echo <(printf "...
0 votes
1 answer
343 views
Named file descriptors with Process Substitution
I'm trying to use named file descriptors with Process Substitution. I wrote the following code but it doesn't work: # Open named file descriptors and associate to Process Substitution result exec {...
0 votes
0 answers
25 views
process substitution for output: syntax error depending on how script is called [duplicate]
The following script results in error when called directly, but not when called with . ./test.sh: % cat test.sh echo "foo" | tee >(rev) % . ./process_subst_test.sh foo oof % ./...
4 votes
1 answer
1k views
Why I need to type press Enter key to finish this command? [duplicate]
I'm a new Linux user and I was doing some experiments and trying to understand Process Substitution. I believe I already have a basic understanding of it. But here is a case that I don't know why. I'm ...
0 votes
0 answers
488 views
Using Process Substitution in docker as input <(command)
Recently, I faced some problems in developing bash pipelines with docker. This regards to the use of process substitution [<()] as input for a specific docker command. I know that this is a problem ...