#! /bin/bash
#题目:写一个脚本,把192.168.2.0/24网段在线的IP列出来
#!/bin/bash
for ip in seq 1 255
do
{
ping -c 1 192.168.2.$ip > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo 192.168.2.$ip UP
else
echo 192.168.2.$ip DOWN
fi
}&
done
wait
转载于:https://my.oschina.net/AnnaWu/blog/1549308