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