[bash] Add functions waitall and waitany.