↧
Answer by Jesse_b for Ping hosts based on filter and return dead or alive
I believe this will do what you want: pingme () { hostfile="/home/jbutryn/test/hostfile.txt" IFS= mapfile -t hosts < <(cat $hostfile) for host in "${hosts[@]}"; do match=$(echo "$host" | grep -o...
View ArticleAnswer by sebasth for Ping hosts based on filter and return dead or alive
You can use the exit code from ping to determine if ping succeeded or failed. ping HOST -c1 > /dev/null && echo "ALIVE" || echo "DEAD" When host is alive exit code is 0, and for dead 1. To...
View ArticlePing hosts based on filter and return dead or alive
I am trying to create a script that is capable of pinging multiple hosts from a text file in my directory.The hosts are with specific naming conventions and are grouped.E.g in the text fie 10.10.10.10...
View Article