#!/bin/bash
i=0
for var in {1..254}
do
ping -c 2 192.168.1.$var >/dev/null 2>&1
status=$?
if [ $status = 0 ];then
echo "ping 192.168.1.$var is up" >>up.txt
else
echo "ping 192.168.1.$var is down" >>down.txt
fi
done
i=0
for var in {1..254}
do
ping -c 2 192.168.1.$var >/dev/null 2>&1
status=$?
if [ $status = 0 ];then
echo "ping 192.168.1.$var is up" >>up.txt
else
echo "ping 192.168.1.$var is down" >>down.txt
fi
done