I need to run a dig on domains and these domains aliases, so the result will be: IF domain (+ doesn't have an alias) and is using my Name Servers -> then print out IF both domain and alias are using my Name Servers -> then print out Everything else no (including when domain is using my Name Servers and alias don't).I have domains stored in MySQL and there's the script I am working on: for domain in `echo $QUERY1 | mysql -N -s -u $USER -p$PASS $DBNAME -h$HOST | awk '{print $1}'; do        lookup=$(dig $domain ns +short)        if [[ $lookup =~ 'XXX' ]]; then            our=1            break        else            our=0            break        fi    doneIn this QUERY I am listing everything (both domains and aliases). I can of course create another query to list only aliases or only domains.It would seem that I would need to group together all the aliases of the domain and loop over the domain name + aliases list. If either one not using NS, I would have to set variable that dictates printing the domain.Let me know, what are your ideas and please share the solution, if possible.
Perform dig on two lists
linux;bash;shell;scripting