#!/bin/bash args=("$@") norm="\e[0m" blue="\e[34m" red="\e[31m" printf "%s \t[$blue UP $norm]\n" "$(hostname)" for ((i=0; i < $#; i++)) { ping -c 2 -W 1 -q ${args[$i]} 1>/dev/null if [ $? -eq 0 ]; then printf "%s \t[$blue UP $norm]\n" "${args[$i]}" else printf "%s \t[$red DOWN $norm]\n" "${args[$i]}" fi }