bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SHELLOPTS environment variable causes shell options to cascade


From: Tobi Laskowski
Subject: Re: SHELLOPTS environment variable causes shell options to cascade
Date: Tue, 7 Jan 2025 01:11:53 +0000

> | It is not possible to have a naive SHELLOPTS=myopt configured outside
> | the shell without all future options being exported implicitly.

> I have never used SHELLOPTS, and have never tested this, but:

> Does "unset SHELLOPTS" not work?

It gives:

        bash: unset: SHELLOPTS: cannot unset: readonly variable

> ps: as it is safe, and portable, to unset variables that are not
> set, in any shell, there's no reason not to include the unset in
> all sh scripts, whatever shell variant they are to be interpreted by.

It may be safe, however, it is a bit tedious to such an extent where it seems 
like it's a misuse of SHELLOPTS to try to pre-initialise as an environment 
variable like this to enable an option.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]