From e18c76bf576f113313683d799036bcdddbdfd58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BC=BA=20Initial=20H=20=E0=BC=BB?= Date: Wed, 11 Sep 2024 02:04:38 +0700 Subject: [PATCH] Update dnstest.sh --- dnstest.sh | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/dnstest.sh b/dnstest.sh index ac23b25..db85834 100644 --- a/dnstest.sh +++ b/dnstest.sh @@ -1,14 +1,15 @@ #!/usr/bin/env bash # Check for required commands -command -v bc > /dev/null || { echo "error: bc was not found. Please install bc."; exit 1; } -{ command -v drill > /dev/null && dig=drill; } || { command -v dig > /dev/null && dig=dig; } || { echo "error: dig was not found. Please install dnsutils."; exit 1; } +command -v bc > /dev/null || { echo "error: bc not found. Please install bc."; exit 1; } +command -v drill > /dev/null && dig="drill" || { command -v dig > /dev/null && dig="dig" || { echo "error: dig not found. Please install dnsutils."; exit 1; } } # Extract nameservers from /etc/resolv.conf -NAMESERVERS=$(awk '/^nameserver/ {print $2}' /etc/resolv.conf | sed 's/\(.*\)/&#&/') +NAMESERVERS=$(awk '/^nameserver/ {print $2}' /etc/resolv.conf) # Define DNS providers -PROVIDERSV4=$(cat <