From 2510094461a3f1749a9edc2ee9c64d9125fc084f Mon Sep 17 00:00:00 2001 From: borekon Date: Wed, 11 Oct 2023 08:00:24 +0000 Subject: [PATCH] Using bash substitution --- adblock_test.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/adblock_test.sh b/adblock_test.sh index f8b3734..36e9d25 100644 --- a/adblock_test.sh +++ b/adblock_test.sh @@ -4,14 +4,15 @@ source <(curl -s https://gitea.avc.cx/borekon/scripts/raw/branch/main/colores.sh ip_to_find="0.0.0.0" blocked=0 -if [ -z "$1" ] - then - #dns="127.0.0.1" - dns=$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2) - else - dns=$1 -fi +#if [ -z "$1" ] +# then +# dns=$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2) +# else +# dns=$1 +#fi +dns=${1:-$(head -n 1 /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2)} domains=$(curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts | grep -v ^# | shuf -n 10 | cut -d" " -f2) +verde "Using $dns DNS server" for j in $domains; do echo -e "${YELLOW}$j${NC}:" output=$(dig @$dns $j +short)