练习_while_until

#!/usr/bin/bash
i=2
while [ $i -lt 25 ]
do
        {
                ip=192.168.201.129
                ping -c1 -W1 $ip &>/dev/null
                if [ $? -eq 0 ];then
                        echo "$ip up "
                fi
        }&
        let i++
done
wait
echo "all finish..."

 

#!/usr/bin/bash
i=2

until [ $i -gt 100 ]
do
        let sum+=$i;
        let i++
done

echo "sum:$sum"

  

 

posted @ 2022-11-30 21:08  smatterer  阅读(15)  评论(0)    收藏  举报