A non-login interactive shell (for example: when I open a Terminal window in Ubuntu) loads and executes the file ~/.bashrc
.
Now when I execute a shell script, a non-interactive non-login shell process will be created that will run this shell script.
Is there a file that is loaded and executed by this non-interactive non-login shell?
Edit: The shell I am using is bash
.
Best Answer
From
man bash
, in a non-interactive shell theBASH_ENV
environment variable is evaluated and its content is sourced. So you could use that environment variable to specify a file with your environment settings.By default no files will be sourced in non-interactive mode.