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 11:49:34 +0000
> This is already documented in a couple of different places:
Thanks for providing the relevant sections. This makes sense having read things
more thoroughly, however, most people do not read documentation from top to
bottom. Someone looking for a way to enable a shell option globally will likely
find the SHELLOPTS documentation which says:
> If this variable is in the environment when Bash starts up, each shell option
> in the list will be enabled before reading any startup files.
This line gives the impression that using SHELLOPTS the way setup-ocaml is
using it is a reasonable idea, and does not give any indication that doing so
is going to change shell option behaviour. From my perspective, it would be
helpful to have had a line here that might discourage such misuse of SHELLOPTS,
or at least point a user to read the other relevant sections before trying to
add it to the environment. This way, the behaviour wouldn't come as a surprise.
Here is another project that fell into the same trap:
https://github.com/infertux/bashcov/issues/50.
--
Tobi