#!/bin/sh read -t 8 -p "input ip :" ip if [ -n "`grep $ip /etc/hosts`" ];then echo "The hostname is `grep $ip /etc/hosts|awk '{print $2}'`" else echo "The $ip input is not exist." fi