On Mon, Feb 11, 2013 at 06:59:35PM +0000, Alan Mackenzie wrote: > From a bash script, I'd like to be able to start several subtasks and > react to any one of them completing. I don't think I can do this with > the current bash. The `wait' function either waits on a specified subtask > to finish, or for _all_ subtasks to finish.
This is more of a help-bash matter than a bug-bash one. The general approach is these cases is to set up a trap for SIGCHLD. > The sort of thing I want to do with this is to perform lots of gzippings > in separate tasks, so as to spread them amongst the cores of my 4-core > processor, always keeping 4 subtasks on the go at any time. Oh, THAT particular problem. See http://mywiki.wooledge.org/ProcessManagement#Advanced_questions