I want to write a bash script where I run two commands simultaneously, then continue when they both complete.
Here's something that doesn't work, but I'll put it here to illustrate what I'm trying to do:
#!/bin/bash
./job1 &
./job2
./dostuffwithresults
The script will run both job1 and job2 at the same time, but will only wait for job2 to finish before continuing. If job1 takes longer, then the results might not be ready for the final command.