I have a question is there any possibility for maken a script that you can see if computers are on in your network
when you run the script for ex. ./ping.sh 54 62 62 , a script when you give as argument the last digit of the ip adres of the computers

my network is

This is what i already have but i want to give extra parameters to the script
for example
parameter 1: xx-yy: this parameter ensures that all computers be test in the range of xx-yy eg. 61-67, test all the 7 computers with the last digit

parameter 2: -t , ensures that each number count with 200 eg. -t 17 test the ip adress 217 , -t 17-19 test all the adresses 217 to 219

for ip in 192.168.1.{1..10}; do  # for loop and the {} operator
    ping -c 1 -t 1 > /dev/null 2> /dev/null  # ping and discard output
    if [ $? -eq 0 ]; then  # check the exit code
        echo "${ip} is up" # display the output
        echo "${ip} is down"
1 Year
Discussion Span
Last Post by cereal


did you considered the fping command? With the -g option you can define a range:

fping -c 1 -g
fping -c 1 -g

And to get just the active IPs do:

fping -c 1 -g 2> /dev/null
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.