Date:        Sun, 5 Jan 2025 11:17:05 +0000
    From:        Tobi Laskowski <tobil...@outlook.com>
    Message-ID:  
<lo6p265mb6347c150fce01eac8d194781b1...@lo6p265mb6347.gbrp265.prod.outlook.com>

  | 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 would probably be useful to have that as one of the initial commands
in every script, perhaps after saving its previous value if that is
needed, and then if it is wanted for a sub-shell or exec'd script
set it again, as in:

        SHELLOPTS=whatever script

where whatever might include ${OLDOPTS}.

kre

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.

Reply via email to