I created the following shell script to lookup multiple name servers for a domain.
Code:
#!/bin/bash
echo -n "Enter the domain name and press [ENTER]: "
read domain
result1=`dig +short $domain @4.2.2.1`
revresult1=`host $result1 | cut -f5 -d " "`
echo "test1"
result2=`dig +short $domain @dns1.vistapages.com`
revresult2=`host $result2 | cut -f5 -d " "`
echo "test2"
result3=`dig +short $domain @dns2.vistapages.com`
revresult3=`host $result3 | cut -f5 -d " "`
echo "test3"
result4=`dig +short $domain @ns1.hostmds.com`
revresult4=`host $result4 | cut -f5 -d " "`
echo "test4"
result5=`dig +short $domain @ns1.hostmds.com`
revresult5=`host $result5 | cut -f5 -d " "`
echo "test5"
result6=`dig +short $domain @dns1.hostingplex.com`
revresult6=`host $result6`
echo "test6"
result7=`dig +short $domain @dns2.hostingplex.com`
revresult7=`host $result7`
echo "test7"
echo "================================="
echo " Result at Verizon DNS : $result1"
echo " Reverse at Verizon DNS : $revresult1"
echo "================================="
echo " Result at dns1.vistapages.com : $result2"
echo " Reverse at dns1.vistapages.com : $revresult2"
echo "================================="
echo " Result at dns2.vistapages.com : $result3"
echo " Reverse at dns2.vistapages.com : $revresult3"
echo "================================="
echo " Result at ns1.hostmds.com : $result4"
echo " Reverse at ns1.hostmds.com : $revresult4"
echo "================================="
echo " Result at ns2.hostmds.com : $result5"
echo " Reverse at ns2.hostmds.com : $revresult5"
echo "================================="
echo " Result at dns1.hostingplex.com : $result6"
echo " Reverse at dns1.hostingplex.com : $revresult6"
echo "================================="
echo " Result at dns2.hostingplex.com : $result7"
echo " Reverse at dns2.hostingplex.com : $revresult1"
But when the dns server do not have any result the script generates error.
Code:
Enter the domain name and press [ENTER]: test.com
test1
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] hostname [server]
-a is equivalent to -v -t *
-c specifies query class for non-IN data
-C compares SOA records on authoritative nameservers
-d is equivalent to -v
-l lists all hosts in a domain, using AXFR
-i IP6.INT reverse lookups
-N changes the number of dots allowed before root lookup is done
-r disables recursive processing
-R specifies number of retries for UDP packets
-t specifies the query type
-T enables TCP/IP mode
-v enables verbose output
-w specifies to wait forever for a reply
-W specifies how long to wait for a reply
-4 use IPv4 query transport only
-6 use IPv6 query transport only
-s a SERVFAIL response should stop query
test2
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] hostname [server]
-a is equivalent to -v -t *
-c specifies query class for non-IN data
-C compares SOA records on authoritative nameservers
-d is equivalent to -v
-l lists all hosts in a domain, using AXFR
-i IP6.INT reverse lookups
-N changes the number of dots allowed before root lookup is done
-r disables recursive processing
-R specifies number of retries for UDP packets
-t specifies the query type
-T enables TCP/IP mode
-v enables verbose output
-w specifies to wait forever for a reply
-W specifies how long to wait for a reply
-4 use IPv4 query transport only
-6 use IPv6 query transport only
-s a SERVFAIL response should stop query
test3
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] hostname [server]
-a is equivalent to -v -t *
-c specifies query class for non-IN data
-C compares SOA records on authoritative nameservers
-d is equivalent to -v
-l lists all hosts in a domain, using AXFR
-i IP6.INT reverse lookups
-N changes the number of dots allowed before root lookup is done
-r disables recursive processing
-R specifies number of retries for UDP packets
-t specifies the query type
-T enables TCP/IP mode
-v enables verbose output
-w specifies to wait forever for a reply
-W specifies how long to wait for a reply
-4 use IPv4 query transport only
-6 use IPv6 query transport only
-s a SERVFAIL response should stop query
test4
Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]
[-R number] hostname [server]
-a is equivalent to -v -t *
-c specifies query class for non-IN data
-C compares SOA records on authoritative nameservers
-d is equivalent to -v
-l lists all hosts in a domain, using AXFR
-i IP6.INT reverse lookups
-N changes the number of dots allowed before root lookup is done
-r disables recursive processing
-R specifies number of retries for UDP packets
-t specifies the query type
-T enables TCP/IP mode
-v enables verbose output
-w specifies to wait forever for a reply
-W specifies how long to wait for a reply
-4 use IPv4 query transport only
-6 use IPv6 query transport only
-s a SERVFAIL response should stop query
test5
test6
test7
=================================
Result at Verizon DNS : 205.178.152.103
Reverse at Verizon DNS : w2k3-cfm3.prod.netsolhost.com.
=================================
Result at dns1.vistapages.com :
Reverse at dns1.vistapages.com :
=================================
Result at dns2.vistapages.com :
Reverse at dns2.vistapages.com :
=================================
Result at ns1.hostmds.com :
Reverse at ns1.hostmds.com :
=================================
Result at ns2.hostmds.com :
Reverse at ns2.hostmds.com :
=================================
Result at dns1.hostingplex.com : 208.83.209.12
Reverse at dns1.hostingplex.com : 12.209.83.208.in-addr.arpa domain name pointer 208-83-209-12.mdswireless.com.
=================================
Result at dns2.hostingplex.com : 208.83.209.12
Reverse at dns2.hostingplex.com : w2k3-cfm3.prod.netsolhost.com.
Hello, All.
please help me with this problem.
i need to use variable as regular expression.
some thing like this:
BEGIN {
RS="\n";
ORS="\n";
reg_exp = ".+Dec.+";
# i mean that regular expression is any symbol before "Dec" and any symbol after it. For example <Worksheet... (6 Replies)
Hi All,
I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both.
The value of $? is coming 0 in if part also and else part too.
#!/bin/ksh
if ]; then
echo "data"
# exit 0
echo "$?"
else... (4 Replies)
I want to count the number of lines in a file and store it in a variable if this count is zero i hv to throw an error ...is this syntax correct , but i am not getting the desired result
I am not using -s option here as i am concerned about record count not the size
#!/bin/ksh
set $count1... (4 Replies)
I have a script (multirun.sh) which launches the program bsim_em.x or bsim_es.x depending on the value entered from the screen:
> multirun.sh 1 (executes bsim_em.x)
> multirun.sh 2 (executes bsim_es.x)
which, simplifying, I do with the following lines in the multirun.sh script:
if ... (3 Replies)
I need to create a script that has a user enter a value. I want to verify that the value is either 1,2, or 3. If it is not then I want them to try entering it again. I am using a while loop to force them to retry.
I am able to test the input against 1,2, and 3, but when I test agains an... (4 Replies)
I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Hi,
Below shell script executes based on liasted data files parameters.But small problem need to avoid ,If any empty line occures in dat files it's throwing oracle error .Need to ignore empty lines (means does not ready by script).Please advice.
#/bin/sh
adsts=`cat... (2 Replies)
Hello,
I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall:
I regularly need to delete files from many directories.
A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Hello Team,
I need bash script to check if my output is non numerical or empty. if its then my output should display default value as 0
basically, I am reading value from txt file. most of numerical value, in case there is no numerical value or its empty, then my output should be 0.
... (5 Replies)
The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format:
input
chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18
chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)