📅  最后修改于: 2022-03-11 14:50:24.057000             🧑  作者: Mango
#!/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