#!/bin/bash
for n in {100..200};do
host=192.168.1.$n
ping -c2 $host &>/dev/null
if [ $? -eq 0 ];then
echo "$host is up"
echo "$host" >> /root/alive.txt
else
echo "$host is down"
fi
done
#!/bin/bash
for n in {100..200};do
host=192.168.1.$n
ping -c2 $host &>/dev/null
if [ $? -eq 0 ];then
echo "$host is up"
echo "$host" >> /root/alive.txt
else
echo "$host is down"
fi
done