首页 > 其他分享 >练习_while_until

练习_while_until

时间:2022-11-30 21:11:06浏览次数:31  
标签:ip sum 练习 echo while let 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"

  

 

标签:ip,sum,练习,echo,while,let,until
From: https://www.cnblogs.com/smatter/p/16939757.html

相关文章