0

I'm relatively new to Linux and attempting the following:

I currently have a simple bash loop where I'm hoping to iterate through a list of IPs in a file to output respective 'whois' information. When I run the 'whois [IP]' command individually, it works fine. However, when I attempt to loop them in a script file, I get the following error: No whois server is known for this kind of object.

I know of one resolution where I can add a list of all known TLDs (as of June/2019) to a file in /etc/whois.conf

My current bash script is as follows:

#!/bin/bash
for ip in $whois_test ; do
  whois $ip
done

Ultimately, I'm trying to develop a script that can iterate through any size list of IPs and output whois information - without erroring, of course. Thank you!

Alfe
  • 56,346
  • 20
  • 107
  • 159
  • Try `#!/bin/bash` instead of `!/bin/bash`. -- EDIT: I fixed that; that probably wasn't your problem. – Alfe Aug 08 '19 at 15:46
  • 1
    Add output of `echo "$whois_test"` to your question. – Cyrus Aug 08 '19 at 15:49
  • I propose to `echo ">>$ip<<"` before the `whois "$ip"` call. The output will probably surprise you. – Alfe Aug 08 '19 at 15:49
  • First it depends on the whois client, we do not know which one you use. Then you probably have an unexpected entry in `$whois_test`, so you need to pring each `$ip` to see which one is misbehaving. Note also that whois output is typically rate limited, and if you are only searching for IP addresses, that is in RIR databases, you should probably look instead at RDAP than whois, far bigger feature-set – Patrick Mevzek Aug 09 '19 at 17:45

0 Answers0