#!/bin/sh hosts="www alf3 friends65 csi193 action1 action2 brigada34 brigada33 seinfeld2 trfs194 hosta hostb hostc trfs193 swat37 swat38 heman130 dukes196 dukes193 dukes194 simpsons2 simpsons1 telnet simpsons129 heman130 ftp seinfeld1" for host in $hosts do echo -n "Pingueando $host: " res=`ping -W1 -c1 $host | grep from` if [ -z "$res" ] then echo 'ERROR!' else echo "$res" fi done