On Fri, May 04, 2012 at 12:41:03PM -0400, Mike Frysinger wrote:
> i wish there was a way to use `wait` that didn't block until all the pids 
> returned.  maybe a dedicated option, or a shopt to enable this, or a new 
> command.
wait takes arguments.

> for example, if i launched 10 jobs in the background, i usually want to wait 
> for the first one to exit so i can queue up another one, not wait for all of 
> them.

Do you mean "for *any* one of them", or literally "for the first one"?
The latter, you can do right now -- just pass the PID of the first one.
The former would require that you set up a SIGCHLD trap and do some work.

By the way, "help wait" is misleading; it says you can only pass a single
job ID argument.  The man page indicates that you can pass multiple
arguments.

Reply via email to