DNS resolution functions for shell scripting.
dns_lookup $hostnamePerforms a DNS lookup for $hostname. The difference between this function and
dns_resolve is that this version uses the operating system native DNS resolution
mechanism, so hostnames like localhost resolve as expected.
dns_resolve $hostname [$record_type = "A"]Performs a DNS lookup for $hostname. This function performs a DNS query,
so an actual DNS record needs to exist. $record_type may be specified for the
type of DNS record to query for.
dns_reverse $ipPerforms a reverse DNS lookup on IP address $ip.
#!/usr/bin/env importimport dns
# Resolve `localhost` to an IP addressdns_lookup localhost#!/usr/bin/env importimport dns
# Query the `A` recordsdns_resolve import.pw
# Query the `MX` recordsdns_resolve import.pw MX#!/usr/bin/env importimport dns
dns_reverse 8.8.8.8