script
#!/bin/sh
if [ $# -ne 3 ]
then
echo "You must provide arguments to the script. 1 is the subnet, 2 is the start address, 3 is the end address."
exit
fi
PREFIX=$1
SUFFIXSTART=$2
SUFFIXEND=`expr $3 + 1`
while [ $SUFFIXSTART -ne $SUFFIXEND ]
do
ADDR="${PREFIX}.${SUFFIXSTART}"
ping -c1 ${ADDR} > /dev/null
if [ $? -eq 0 ]
then
echo "$ADDR is up!"
else
echo "$ADDR is down!"
fi
SUFFIXSTART=`expr $SUFFIXSTART + 1`
done