#!/bin/bash ping_success_status() { if ping -c 1 $IP >/dev/null;then echo "$IP Ping is successful!" continue fi } IP_LIST="192.168.164.1 58.87.108.139" for IP in $IP_LIST;do ping_success_status ping_success_status ping_success_status echo "$IP Ping is failure!" done