#!/usr/bin/env bash IPFILE="iplist.txt" for ip in $(cat $IPFILE) do ping -c1 $ip > /dev/null if [ $? -eq 0 ] then echo $ip is GOOD else echo $ip is NOT GOOD fi done