等待进程结束后响铃提示

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
 
ring()
{
    tick=$2
    freq=$1
 
    for i in `seq 0 $tick`; do
        echo -en '\a'
        sleep $freq
    done
}
 
pid=$1
echo "Wait process $pid ..."
while true; do
    list=($(ps ax | awk "\$1==$pid {print \$1}"))
    if [ ${#list[*]} -eq 0 ]; then
        echo "Process $pid done."
        break
    fi
    sleep 1
done
ring 0.2 100