Date: Tue, 12 Mar 2024 18:32:19 +1000 From: Martin D Kealey <mar...@kurahaupo.gen.nz> Message-ID: <can_u6mxcx2gnc2eyxvao3zssmvroudodkheu_y9lmfktjbq...@mail.gmail.com>
| You don't need '-n' when you specify a PID; the fix is simply to remove it. That's OK, when there is exactly one PID, but for a task like this, wait -n -p pid PID1 PID2 PID3 ... would be a better invocation, to wait for whichever of the list finishes first. Still doesn't get around the bash idiocy though (for which there is a very simple solution, I think, which I suggested to Chet off list a while ago). In a more realistic application, where the tasks all take longer than the script takes to start them, and get to the point of waiting, solutions using -n would mostly work, even in bash. It just fails when the tasks have finished before "wait -n" is performed (or if they are killed by a signal). kre