On 8/6/20 10:48 AM, Chet Ramey wrote: >> Perhaps another, clunkier, proposal would be to add `wait -s` so that >> the wait builtin also waits for process substitutions and returns >> their exit codes and changes $?. The downside would be that scripts >> now need to add a "wait" after all of above such loops, but on the >> upside, it's better than the current problematic situation. > > You can already do this. Since process substitution sets $!, you can > keep track of all of the process substitutions of interest and wait > for as many of them as you like. `wait' will return their statuses > and set $? for you.
I should have also mentioned that while bash-5.0 requires you to wait for these process substitutions one at a time, in between their creation, bash-5.1 will allow you to save $! and wait for them later: $ cat x2 : <(sleep 5; exit 1) P1=$! : <(sleep 5; exit 2) P2=$! : <(sleep 5; exit 3) P3=$! wait $P1 ; echo $? wait $P2 ; echo $? wait $P3 ; echo $? $ ../bash-5.1-alpha/bash x2 1 2 3 -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/