📜  bash 监控后台作业 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:24.057000             🧑  作者: Mango

代码示例1
#!/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