Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Andreas Schwab
On Jan 05 2025, Tobi Laskowski wrote: > "Additionally, if it is in the environment at start up, the variable is > automatically exported That is a general property of every environment variable. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Tobi Laskowski
>> On the other hand, if there is a pre-existing SHELLOPTS environment variable >> (set outside the current shell), then the `nounset` option applies to all >> invocations of bash within the current shell. > This is documented in the manual: >> A colon-separated list of enabled shell options. >

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Martin D Kealey
On Sun, 5 Jan 2025 at 15:18, Oğuz wrote: > This is documented in the manual: > In other words, it's broken by design. > Try BASH_ENV instead: > > https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-BASH_005fENV > Don't forget ENV as well, for sh scripts. -Martin

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Koichi Murase
2025年1月5日(日) 5:43 Tobi Laskowski : > On the other hand, if there is a pre-existing SHELLOPTS environment > variable (set outside the current shell), then the `nounset` option > applies to all invocations of bash within the current shell. This is documented as Oguz pointed out. > Even with the `+u

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Oğuz
On Sunday, January 5, 2025, Martin D Kealey wrote: > > In other words, it's broken by design. > Maybe. I'm not sure if propagating shell options to child shells was the intended primary use. With ENV/BASH_ENV you can already do that and more, I don't see the point in adding an environment variabl

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Greg Wooledge
On Sun, Jan 05, 2025 at 19:10:41 +0900, Koichi Murase wrote: > I confirmed this behavior, which I think is unreasonable. > > $ (export SHELLOPTS; set -u; bash +u -c 'echo $unset') > bash: line 1: unset: unbound variable > > I think an option explicitly specified in the command-line arguments

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread G. Branden Robinson
At 2025-01-05T18:59:57+1000, Martin D Kealey wrote: > On Sun, 5 Jan 2025 at 15:18, Oğuz wrote: > > This is documented in the manual: > > In other words, it's broken by design. Well, pull out of your back pocket what you've been coyly keeping from us--a programming language that occupies global o

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Robert Elz
Date:Sun, 5 Jan 2025 11:17:05 + From:Tobi Laskowski Message-ID: | 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