Wednesday, July 17, 2013

write a Bourne shell script doman2ip that takes a list of domain names as command line arguments and displays their IP addresses. use the nslookup command. the following is a sample run of this program

#!/bin/bash
#####################################################
# Name: sy_8
#
# Usage: ./sy_8
#
# Author: Suresh Yadagiri
# Date:  August 06,2010
# Requirements:
#
#   write a Bourne shell script doman2ip that takes a list of
#   domain names as command line arguments and displays their
#   IP addresses. use the nslookup command. the following is
#   a sample run of this program
#  
#   $domanin2ip  up.edu  redhat.com
#    Name  : up.edu
#    Address : 192.220.208.9
#
#    Name  : redhat.com
#    Address : 207.175.42.154
#####################################################


function printusageinfo(){
echo -e "\nUsage: $0 \n"
}


if [ $# -eq 0 ]
then
        echo "At least one argument expected"
        printusageinfo
        exit
fi


while [ $# != 0 ]
do
nslookup $1 | tail +5
shift
done

No comments:

Post a Comment