我希望用dig获取域名的IP地址,然后对该IP地址执行whois查找。
我试过这个:
dig domain.dk +short | whois发布于 2014-10-30 12:49:35
一种选择是只写:
whois $(dig example.com +short)请注意,dig可能返回多个IP地址,因此whois有时可能会抱怨它不知道使用哪个服务器。在这种情况下,您可能需要选择查找哪个IP地址。你可以选择第一个:
whois $(dig example.com +short | head -n1)另一种更容易理解的方式是:( @tripleee在评论中指出),这也稍微接近了您最初的问题:
dig +short example.com | xargs whois( dig +short example.com | head -n1 | xargs whois只查找dig返回的第一个IP地址)
https://stackoverflow.com/questions/26642938
复制相似问题