LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-05-2019, 08:54 AM   #1
symudy
LQ Newbie
 
Registered: Mar 2019
Posts: 1

Rep: Reputation: Disabled
Help with bash script for DNS


Hello guys,

How could i make bash script to filter this DNS Resolver
https://public-dns.info/nameservers.txt

because it came out with false positive results

So the idea is could it be as following code
Code:
#!/bin/sh
for IP in `cat ./resolvers.txt`;
do
	printf "%-4s", $IP 
	dig @$IP test.com;
	
done
 
Old 03-05-2019, 11:30 AM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,266

Rep: Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495
It's not at all clear what you're expecting to accomplish.
What do you mean by false positive?

test.com is a real domain name...it should give a positive response.
 
Old 03-20-2019, 08:44 AM   #3
Honest Abe
Member
 
Registered: May 2018
Distribution: CentOS 7, OpenSUSE 15
Posts: 330
Blog Entries: 1

Rep: Reputation: 161Reputation: 161
@OP, use a while loop and try again. For loop could spew garbage if empty white spaces exists in your file.

Code:
cat FILE |while read line 
do
<what u wanna do>
done
And of course, provide outputs. One user's garbage is one admin's treasure.

Last edited by Honest Abe; 03-20-2019 at 08:48 AM.
 
1 members found this post helpful.
Old 03-20-2019, 10:02 AM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 3,959

Rep: Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109
Quote:
Originally Posted by Honest Abe View Post
Code:
cat FILE |while read line 
do
<what u wanna do>
done
Cat abuse alert. Better:
Code:
while read line 
do
<what u wanna do>
done < FILE
 
2 members found this post helpful.
Old 03-20-2019, 10:12 AM   #5
Honest Abe
Member
 
Registered: May 2018
Distribution: CentOS 7, OpenSUSE 15
Posts: 330
Blog Entries: 1

Rep: Reputation: 161Reputation: 161
yes, that too.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] BASH Script - What am I doing wrong in this test? - BASH Script BW-userx Programming 34 04-08-2017 02:36 PM
Bash script that acts as a DNS proxy, except it queries several DNS servers Ulysses_ Linux - Networking 11 03-06-2014 01:31 PM
SSH connection from BASH script stops further BASH script commands tardis1 Linux - Newbie 3 12-06-2010 09:56 AM
Win2k3 DNS + PFsense DNS Forwarder = No internal DNS resolution Panopticon Linux - Networking 1 11-19-2007 10:59 PM
Bash script to create bash script jag7720 Programming 10 09-10-2007 08:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration