Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
4
Impact
~11k people reached

  • 0 posts edited
  • 0 helpful flags
  • 3 votes cast
Jul
28
comment Script or tool to get the IP address of a remote host
I'm not sure I understand your meaning. The snippet you provided explicitly queries both A and AAAA, so it's IPv6-aware. I agree insofar as your assertion that you share functionality with the original, but I think that the goal is to improve on what was in the question, not merely to parrot its shortcomings.
Jul
9
comment Script or tool to get the IP address of a remote host
Most stacks prefer IPv6, if available; consequently, you probably want tail -n 1 at the top level, as well, if you want to mirror the host's resolve order. Then again, this whole approach also doesn't respect NIS, or /etc/hosts, or nsswitch.conf, and yet I use it regularly nonetheless on machines where resolveip -s isn't necessarily available, so perhaps I'm being a bit too pedantic. ;)