mirror of
https://github.com/bitnami/containers.git
synced 2026-03-14 06:48:11 +08:00
12.5.0-debian-10-r32 release
This commit is contained in:
@@ -10,15 +10,17 @@
|
||||
# Functions
|
||||
|
||||
########################
|
||||
# Resolve dns
|
||||
# Resolve IP address for a host/domain (i.e. DNS lookup)
|
||||
# Arguments:
|
||||
# $1 - Hostname to resolve
|
||||
# $2 - IP address version (v4, v6), leave empty for resolving to any version
|
||||
# Returns:
|
||||
# IP
|
||||
#########################
|
||||
dns_lookup() {
|
||||
local host="${1:?host is missing}"
|
||||
getent ahosts "$host" | awk '/STREAM/ {print $1 }'
|
||||
local ip_version="${2:-}"
|
||||
getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1
|
||||
}
|
||||
|
||||
#########################
|
||||
|
||||
Reference in New Issue
Block a user