Useful commands:

  • wait <pid>: wait the background job with specified pid to be finished and return the exit code ( hint: stored in $? )
  • jobs -p: list the pids of all the background jobs (hint: use for statement of bash to loop over each process)
  • ( sleep 30s; /bin/false ) & : generate a background testing job with a error exit code

First, submit all the background jobs, no matter you use loop or line by line in a script.
Next, get the PIDs of the background jobs. After submitting EACH job, the PID of that job is in $!, which can be store to any user defined variable for later use.
Last, check the exit codes. You can either check the exit code of each job one by one or calculate the accumulative exit code. To check them one by one, just call wait command for each PID stored in previous step and check the value of $?; to check them cumulatively, see this post. (the trick is the sum of exit codes for all jobs should be zero if all jobs are finished successfully, or the sum must be non-zero)