Home:ALL Converter>Issue with ping sweep that reads in an IP address

Issue with ping sweep that reads in an IP address

Ask Time:2021-03-21T04:35:46         Author:Jesse Hix

Json Formatter

The main issue I am having with this is pinging the read in IP address. It always says that the address is down.

Ping_Sweep()
{
echo -e '\n'
echo  '----- Ping Sweep -----'
echo -e '\n'
command date >>  pingresults.tx
echo "Enter in the first three number sequences of an IP address (ex. ###.###.###): "
read -r ip_address
for x in $ip_address
do
    echo "IP address being pinged: $ip_address"
    if ping –c 1 "$x" &> /dev/null 
    then
        echo "IP: $x is up."
    else  
        echo "Ping failed. $x is down."
    fi
done
Main_Menu
}

Author:Jesse Hix,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/66726227/issue-with-ping-sweep-that-reads-in-an-ip-address
yy