Waiting on background tasks
Erik Christiansen
erik at dd.nec.com.au
Mon Apr 10 07:32:47 UTC 2006
On Mon, Apr 10, 2006 at 12:40:39AM -0500, Kenneth P. Turvey wrote:
> Is there a way to start a number of background tasks and then wait for
> them all to complete? That is I would like something like this:
>
> longtask arg1 &
> longtask arg2 &
> longtask arg3 &
> waitforalltasks
> #do the next thing
The bash shell has a built-in "wait [n]". From man bash: "If n is not
given, all currently active child processes are waited for, and the
return status is zero."
So just delete "foralltasks" ;-)
Erik
More information about the ubuntu-users
mailing list