#!/bin/sh NET=$1 START=$2 STOP=$3 LIST=/var/run/client-list.txt : > $LIST for ip in $(seq $START $STOP); do ping -c2 -w2 $NET.$ip > /dev/null; [ $? -eq 0 ] && echo "$NET.$ip UP" >> $LIST || echo "$NET.$ip DOWN" >> $LIST; done