The whole tower of Hanoi in pubkeygrab.sh script, complete with two greps and a sed could be replaced with just sed:<p><pre><code>  unbound-host -v -D -t TXT ${USER}_pubkey.example.com \
   | sed &#x27;s&#x2F;.*has TXT record &quot;\(ssh-.*\)&quot; (secure)&#x2F;\1&#x2F;p;d&#x27;
</code></pre>
Or, even without sed, reducing to one-liner:<p><pre><code>  dig +short +dnssec +sigchase txt $1_pubkey.example.com
</code></pre>
EDIT: to address &quot;wtf&quot; concern by ryanlol, we can use a custom trust anchor:<p><pre><code>  dig +short +dnssec +sigchase +trusted-key=&#x2F;etc&#x2F;my.key txt $1_pubkey.example.com</code></pre>