(This post was originally written as a reply on the mailop mailing-list, but a friend asked me to turn it into a blog post. I’ve edited it, mostly adding more links to elsewhere, but there are some additions here.) Context: someone with a mail-server hosted in a German facility with a poor reputation for handling abuse reports was asking for help on sending email to their Gmail-using friends; they had SPF and didn’t see the point of DKIM; they had TLS setup for their mail-server, using a certificate from CACert.
When a shell function declares a variable to be local and then unsets it, does the name return to being global in scope or is it still “known” to be local, even though unset (via some kind of tombstone mechanism, perhaps)? Let’s test it. Spoiler: the results vary. Note that POSIX does not provide local, this is a shell extension. The Test Here is our test as a pasteable one-liner: