From ec58c138cc39aed0ab0e978778185bdf5997b55a Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 10 Sep 2022 17:11:14 +0000 Subject: [PATCH] config/shell/functions: fix dns malformatting --- .config/shell/functions | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index f4ff18c..56fd325 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -268,11 +268,18 @@ u() { # Networking dns() { - local dig="$(which drill || echo "dig +short")" + local dig="drill -Q" + which drill >/dev/null || dig="dig +short" + local server=1.1.1.1 + # allow changing DNS server with @ # TODO implement rdns via -x for arg; do - $dig A @8.8.8.8 -Q "${arg##*/}" - $dig AAAA @8.8.8.8 -Q "${arg##*/}" + if which host >/dev/null 2>&1 + then host "${arg##*/}" $server + else + $(echo $dig) A @$server "${arg##*/}" + $(echo $dig) AAAA @$server "${arg##*/}" + fi done } alias sshk="$(case $TERM in (*-kitty) echo 'TERM=xterm-256color kitty +kitten';; esac) ssh"