wlan2eth/bridge/nat/get-dhcp-dns.sh

10 lines
394 B
Bash
Executable File

get_dns_servers() {
local interface="$1"
resolvectl status | awk -v iface="Link [0-9]+ \\($interface\\)" '$0 ~ iface {flag=1; next} flag && /DNS Servers/ {gsub(",", ""); print; exit}' | awk -F ': ' '{print $2}'
}
get_dns_domain() {
local interface="$1"
resolvectl status | awk -v iface="Link [0-9]+ \\($interface\\)" '$0 ~ iface {flag=1; next} flag && /DNS Domain/ {print $3; exit}'
}