I'm trying to understand how the $BASH_ENV variable gets set in a Red Hat installation. I've read the GNU page on Bash Startup Files. It states it's Invoked non-interactively and says
and goes on to say
But it doesn't say how BASH_ENV is read into the environment. I suspect it means when a Bash shell is invoked in a non-interactive login mode, it reads both /etc/bashrc and ~/.bashrc, but I'm not seeing anything directly referencing that.
I'm also not seeing anything about how BASH_ENV is read in non-interactive non-login mode (Which is what I'm actually curious about).
Can someone clear this up for me? Thanks!
When Bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute
and goes on to say
As noted above, if a non-interactive shell is invoked with the --login option, Bash attempts to read and execute commands from the login shell startup files.
But it doesn't say how BASH_ENV is read into the environment. I suspect it means when a Bash shell is invoked in a non-interactive login mode, it reads both /etc/bashrc and ~/.bashrc, but I'm not seeing anything directly referencing that.
I'm also not seeing anything about how BASH_ENV is read in non-interactive non-login mode (Which is what I'm actually curious about).
Can someone clear this up for me? Thanks!
Last edited: