Synchronizing Completion of Concurrent Commands

Running concurrent commands in a script generally is done by executing processes in the background. Numerous commands can be spawned concurrently then synchronized by waiting for some, or all, of them to complete before proceeding or terminating the parent script. 1 #!/bin/bash 2 3 sleep 10 & 4 pId1=$! 5 6 sleep 2 & 7 pId2=$! 8 9 sleep 3 & 10 pId3=$! 11 12 echo "waiting for jobs to complete" 13…