F
F
fokin_nikolay19892016-07-06 15:35:24
bash
fokin_nikolay1989, 2016-07-06 15:35:24

ping implementation in bash?

Good afternoon, there is a ping implementation in bash

#!/bin/bash
echo -n "Введите сеть которую вы хотите просканировать 10.1.xx.{1..255}"
read p_set
is_alive_ping()
{
  ping -c 1 $1 > /dev/null
  [ $? -eq 0 ] && echo Оборудование с IP: $i находиться в сети.
}

for i in 10.1.$p_set.{1..255}
do
is_alive_ping $i & disown
done

tell me how you can add the script so that the scan was not only on the subnet, but also on the mask, there was a check, this is so that for example there can be two subnets on the same network, for example 1 and 2, changing only the mask.
And also on windows, if you do ping -a 10.1.1.0, it will display the ping and the computer name, I would also like to add such a useful thing to this code

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question