Last active
February 25, 2025 15:12
-
-
Save dgibbs64/caf22d84c9a6418449645156b27f7db5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Read the hosts from the file into an array | |
mapfile -t hosts < hosts.txt | |
# Loop through each host | |
for host in "${hosts[@]}"; do | |
echo -en "Checking DNS for $host... " | |
if dig +short "$host" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then | |
echo "pass" | |
else | |
echo "fail" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment