How to get the exit status of multiple parallel background processes in bash

Viewed 4621

In Bash, I want to call a command multiple times in parallel, while capturing all the processes exit codes.

I know how to start and wait for them, but wait will only give me the exit code of the last process exiting. I also need the exit code of the shorter lived processes.

Unfortunately I don't have bash 4.3, so wait -n is not an option, nor is gnu parallel as suggested in #3004811

#16032001 pretty much asks the same question but no solution was offered there either.

The only way I can currently think of is writing a helper script that stores the exit codes in a file, but this doesn't sound like a clean solution.

1 Answers
Related