Answers for "bash monitoring background jobs"

0

bash monitoring background jobs

#!/bin/bash

# when running "some commands" in the background in your script with '&' 
# and want to wait until they are finished, 
# you can check the number of background jobs in a loop with the jobs command

while [[ $(jobs -r | wc -l) -gt 0 ]]; do
sleep 1
done
Posted by: Guest on October-28-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language