From the manual:
wait [-fn] [-p varname] [id ...]
Wait for each specified child process and return its termination
status. Each id may be a process ID or a job specification; if a job
spec is given, all processes in that job's pipeline are waited for. If
id is not given, wait waits for all running background jobs and the
last-executed process substitution, if its process id is the same as
$!, and the return status is zero. [...]
Why do this?
Because it sets $!. You should always be able to wait for $!. Originally
there was no way to wait for a process substitution at all.
Why not just wait for all process substitutions?
Process substitutions are word expansions, with a scope of a single
command, and are not expected to survive their read/write file descriptors
becoming invalid. You shouldn't need to `wait' for them; they're not
true asynchronous processes.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/