#!/bin/bash for host in $(cat $1) do if ping -c 1 -w 5 $host &>/dev/null ; then echo "$host is up" fi done