#!/usr/bin/env bash
## Ping all machines in a Network
PING="$(which ping) -c 1 -W 1"
echo "Enter Subnet(eg:192.168.0)"
read Subnet
echo "Do you want to PING the entire network or a RANGE of IPs ? Enter your choice"
echo 1. Ping Entire Network
echo 2. Ping a RANGE
read choice
if [ $choice = 1 ];
then
{
echo Pinging.....
for((i=1;i<255;i++)); do
${PING} ${Subnet}.${i} > /dev/null 2> /dev/null
if [ $? -eq 0 ];
then
echo -e "${Subnet}.${i} is up"
fi
done
}
fi
if [ $choice = 2 ];
then
{
echo Enter the Starting IP of Range
read a
echo Enter the Last IP of Range
read b
echo Pinging.....
for((i=$a;i<$b;i++)); do
${PING} ${Subnet}.${i} > /dev/null 2> /dev/null
if [ $? -eq 0 ];
then
echo -e "${Subnet}.${i} is up"
fi
done
}
fi
exit 0
Wednesday, October 17, 2007
Subscribe to:
Post Comments (Atom)
AT&T USA | Internet not working | Fix by custom APN
If the AT&T Mobile internet is not working on your cellphone, it can be fixed easily by adding an APN configuration. You can read this a...
-
Hi there, You all know how to check TCP port connectivity from a Linux or UNIX machine to a remote machine using telnet as per th exampl...
-
Before you start Ensure that you have installed wvdial, usbmodeswitch and usbmodeswitch_data # dpkg -l | grep wvdial # dpkg -l | grep ...
-
1. Open Applications -> System -> Configuration Editor from the GUI OR Open a terminal, type gconf-editor 2. Go to "...
2 comments:
I found Most of your posts very useful.
Just a different look of your script:-)
#!/bin/sh
PING="$(which ping) -c 1 -W 1"
echo -n "Enter Subnet(eg:192.168.0): "; read Subnet
while :
do
cat << !
1. Ping Entire Network
2. Ping a RANGE
3. Exit
!
echo -n "Your Choice?"
read choice
case $choice in
1).... ;;
2).... ;;
3) clear; exit ;;
*) echo; echo "\"$choice\" is not a valid option."; sleep 2 ;;
esac
done
//Jadu, http://unstableme.blogspot.com/
Thanks yaar
Post a Comment