Ping Multiple Host

#!/bin/bash

HOSTS=(192.168.3.241 192.168.3.240 192.168.3.21 192.168.3.216 192.168.3.100 192.168.3.213 192.168.2.239 192.168.2.229 192.168.2.230 192.168.2.218 192.168.2.241 192.168.2.206 192.168.3.219)

count=${#HOSTS[@]}
index=0
while [ "$index" -lt "$count" ]; do
 echo -e "-----------------------------------\n"
 echo -e "Haciendo ping ${HOSTS[$index]} ... \n"
 ping -c 3 ${HOSTS[$index]}
 let "index++"
done
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s