shell脚本的多线程

shell脚本的多线程

#!/bin/bash
###这是个多线程脚本!!!!
for i in {1..254}
do
    {
    ping -c 2 192.168.2.$i >/dev/null
    if [ $? = 0 ];then
        echo "192.168.2.$i 存活"
    else
        echo "192.168.2.$i 不存活"
    fi
    } &
done
wait

猜你喜欢

转载自www.cnblogs.com/hui-shao/p/Multithreading.html