等待进程结束后响铃提示

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

#!/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