-dig() {
- command dig +nostats +nocmd "$@"
-}
-# Output with sections sorted, and removal of query id, so 2 dig outputs can be diffed.
-digsort() {
- local sec
- sec=
- dig +nordflag "$@" | sed -r 's/^(;; ->>HEADER<<-.*), id: .*/\1/' | while read -r l; do
- if [[ $l == [^\;]* ]]; then
- sec+="$l"$'\n'
- else
- if [[ $sec ]]; then
- printf "%s" "$sec" | sort
- sec=
- fi
- printf "%s\n" "$l"
- fi
- done
-}
-# note: only the soa master nameserver will respond with
-# ra "recursive answer" flag. That difference is meaningless afaik.
-# Same thing happens with gnu nameservers.