2
votes
1answer
110 views

How to wait for a subprocess used for I/O redirection?

Consider the following snippet of Bash script: exec 3> >(sleep 1; echo "$BASHPID: here") do-something-interesting exec 3>&- wait $! echo "$BASHPID: there" When executed, it produces: ...
3
votes
4answers
408 views

Bash Reuse Process Substitution File

I have a big script which takes a file as input and does various stuff with it. Here is a test version: echo "cat: $1" cat $1 echo "grep: $1" grep hello $1 echo "sed: $1" sed 's/hello/world/g' $1 I ...
14
votes
4answers
1k views

Process substitution and pipe

I was wondering how to understand the following: Piping the stdout of a command into the stdin of another is a powerful technique. But, what if you need to pipe the stdout of multiple ...