Using bash substitution

This commit is contained in:
borekon 2023-10-11 08:00:24 +00:00
parent 3d2f07f9ef
commit 2510094461

View File

@ -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)