IP_PRE=192.168.1
[ -z "$1" ] && echo "Usage: ${0##*/} 15 30-37 42 .."
for num in "${@}";do
# Parse all the arguments
if [ "-" = "$(echo $num|tr -d [[:digit:]])" ]
then # Its a range, as it contains a '-'
range_start=${num/-*}
range_end=${num/*-}
range=${seq $range_start 1 $range_end}
else # It has no range, its a single number
range=$num
fi
# Parse all the numbers filled in range
for r in $range;do
ping -c1 $IP_PRE.$r 2>/dev/zero 1>/dev/zero && \
echo "$IP_PRE.$r is up" || \
echo "$IP_PRE.$r is down"
done
done
Scripts are one of the best things with computers.
Their power mostly underrated, and their writing undervalued.
Posts mit dem Label net werden angezeigt. Alle Posts anzeigen
Posts mit dem Label net werden angezeigt. Alle Posts anzeigen
Dienstag, 19. Mai 2015
Simply check a single ip or a range of ips within your LAN
Abonnieren
Posts (Atom)