[sf-lug] Notice: ns1.svlug.org downtime, DNS secondary

Ronald Barnes ron at ronaldbarnes.ca
Sun Nov 14 12:39:05 PST 2021


Michael Paoli wrote on 2021-11-14 7:57 a.m.:

> echo 'sf-lug.com.
> sflug.org.
> sflug.com.
> sflug.net.
> sf-lug.net.' | (
>    IFS_=".$IFS";
>    while IFS="$IFS_" read subdomain TLD
>    do
>      Authority_NS="$(dig +short "$TLD". NS | head -n 1)"
>      Authority_NS_IP="$(dig +short "$Authority_NS" A "$Authority_NS" 
> AAAA | head -n 1)"
>      dig @"$Authority_NS_IP" +noall +authority +norecurse 
> "$subdomain.$TLD." | fgrep -i svlug || echo OK
>    done
> ) | sort -u
> OK

That's some nifty bash + DNS wizardry there.

But I was really thrown by the Internal Field Separator magic - why 
inside the "while" loop?

I tested it on the outside and got similar results, is it just a 
stylistic preference?

And how does IFS get reset to original value (minus the ".") after the 
script has run?


Thanks Michael,

rb




More information about the sf-lug mailing list