Use a loop:
Code:
command to find server1 server2 server3 | while read SERVER; do
server_ping_check_function "${SERVER}"
done
Code:
function howto() { echo "Bash scripting guides:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html
http://www.gnu.org/software/bash/manual/html_node/index.html
http://www.grymoire.com/Unix/Sh.html
http://www.tldp.org/LDP/abs/html/
http://mywiki.wooledge.org/BashFAQ
http://mywiki.wooledge.org/BashPitfalls"; }
*BTW also have a look at command args (esp. how many times you query, query timeouts and quiet output), realize that not being able to ping a server can have different causes (it doesn't necessarily mean a server is down) and that name lookups can be cached by subsystems like nscd or a caching name server.