X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=brc;h=37e09a0c13399224b748366482fc84b22f7a96ed;hp=fe6528acd093ca63a4c9e4674ef63ae5bdaaa774;hb=79b274fcd8bfa556133ab13270e84b40aebe8468;hpb=2f7b266e782347022b68c5c8e8fbe9292492c343 diff --git a/brc b/brc index fe6528a..37e09a0 100644 --- a/brc +++ b/brc @@ -198,8 +198,10 @@ if [[ -s /usr/share/wcd/wcd-include.sh ]]; then source /usr/share/wcd/wcd-include.sh fi -if [[ -s ~/.iank/ll-function ]]; then - # shellcheck source=.iank/ll-function +if [[ -s /a/bin/small-misc-bash/ll-function ]]; then + # shellcheck source=/a/bin/small-misc-bash/ll-function + source /a/bin/small-misc-bash/ll-function +elif [[ -s ~/.iank/ll-function ]]; then source ~/.iank/ll-function fi @@ -410,6 +412,39 @@ despace() { done } +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 +} +# compare digs to the 2 servers +# usage: digdiff @server1 @server2 DIG_ARGS +# note: only the soa master nameserver will respond with +# ra "recursive answer" flag. That difference is meaningless afaik. +digdiff() { + local s1 s2 + s1=$1 + shift + s2=$1 + shift + digsort $s1 "$@" | tee /tmp/digdiff + diff -u /tmp/digdiff <(digsort $s2 "$@") +} + dt() { date "+%A, %B %d, %r" "$@" } @@ -422,10 +457,25 @@ dus() { # du, sorted, default arg of e() { echo "$@"; } -# echo var. print var including escapes, etc +# echo args +ea() { + if (( ! $# )); then + echo no args + fi + for arg; do + printf "%qEOL\n" "${arg}" + printf "%s" "${arg}" |& hexdump -C + done +} +# echo vars. print var including escapes, etc ev() { - printf "%qEOL\n" "${!1}" - printf "%s" "${!1}" |& hexdump -C + if (( ! $# )); then + echo no args + fi + for arg; do + printf "%qEOL\n" "${!arg}" + printf "%s" "${!arg}" |& hexdump -C + done } @@ -441,6 +491,12 @@ etail() { eless() { less /var/log/exim4/mainlog } +eqcat() { + exiqgrep -i | while read i; do + exim -Mvh $i; hr; exim -Mvb $i; hr; + exigrep $i /var/log/exim4/mainlog; hr + done +} # shellcheck disable=SC2032