#!/bin/bash i=$(sudo tail -n2 /var/log/messages|fgrep -i icmp| cut -d"=" -f 5| tr -d [:alpha:]) #echo $i if [ "$i" -z ]; then echo "nobody ping-ed you man" $i else echo "thisone pinged you:" $i fi