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:
a.sh: line 4: wait: pid 1001 is not a child of this shell 1000: there 1001: here
How can I modify the
wait line so that it actually waits for the termination of
1001? In other words, I can I change the script so that the output becomes:
1001: here 1000: there