Re: SHELLOPTS environment variable causes shell options to cascade
From:
Martin D Kealey
Subject:
Re: SHELLOPTS environment variable causes shell options to cascade
Date:
Wed, 8 Jan 2025 08:44:06 +1000
On Tue, 7 Jan 2025, 21:24 Tobi Laskowski, <tobil4sk@outlook.com> wrote:
> the issue starts with misusing SHELLOPTS.
Some folk have taken issue with my suggestion that SHELLOPTS is broken by
design. Perhaps that was hyperbole, but it seems to me that if all possible
uses for a feature actually constitute misuses, then that feature is broken.
I invite anyone to provide an example of how exporting SHELLOPTS can be
useful and safe when it interacts with set -e or other common features in
production code. In short, can it ever be used in a way that does not
misuse?
Just to be clear, I know that there are useful non-production uses for
SHELLOPTS (such as debugging or delinting), but if it has no safe
production use then perhaps that should be highlighted in the
documentation. This might be a good place to start using the term
"deprecated" in the manual, rather than simply hiding obsolete features and
not mentioning them at all.
-Martin
-Martin