The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #9 (permalink)  
Old 10-24-2008
sethcoop sethcoop is offline
Registered User
  
 

Join Date: Oct 2008
Location: United States
Posts: 34
Give this a shot...


Code:
 
#!/bin/ksh
List=pinglist1.txt

cat $List | while read ip
do

  ping -c 2 $ip
  rc=$?
 
  if [[ "$rc" = "0" ]]
  then
    echo "$ip PINGS">>pingresults.txt
  else
    echo "$ip DOESN'T PING">>pingresults.txt
  fi
done