Re: [PATCH v2 5/8] builtins/source: parse the -i option
From:
Greg Wooledge
Subject:
Re: [PATCH v2 5/8] builtins/source: parse the -i option
Date:
Sat, 18 May 2024 09:01:40 -0400
On Sat, May 18, 2024 at 08:39:57AM -0300, Matheus Afonso Martins Moreira wrote:
> > Setting the variable at all is opting in to new behavior, and you do
> > that at your own risk, after reading the documentation and deciding
> > that this is what you want.
>
> As the user, it should be my prerogative to set the
> variable on my environment and/or rc so that I can
> organize my sourceable scripts however I want and
> have the scripts which enabled the isolated sourcing
> just work no matter where I chose to install them.
>
> As the user, I should be able to run shell scripts
> regardless of whether they support this or not.
> I should be to set this variable on my .bashrc
> and enjoy the nice infrastructure it provides
> without worrying about whether or not
> some script takes it into account.
You've made contradictory statements here.
First you said you wanted to put it into your *environment*. That would
cause shell scripts to see it and exhibit a change in behavior.
Next you said you would like to set it in your .bashrc file. That's
totally different. Setting it in .bashrc *without* putting it into the
environment (no export) is "safe". It will only affect your interactive
shell, and not any scripts that you run.