System Environment Variables Paths
You can start a bash shell with one of the following ways:
-
Login shell.
-
The interactive shell.
-
The non-interactive shell.
login shell
When you log onto the system, the search for those startup files to process the commands from them:
-
/etc/profile
-
$HOME/.bash_login
-
$HOME/.bash_profile
-
$HOME/.profile
/etc/profile runs on every startup with every user, the other 3 files run for every specific user, you can call them user specific environment variables.
Interactive shell
When you go to the rescue mode, this is the interactive shell.
If you start an Interactive shell, the system will not look for /etc/profile but instead will look for .bashrc in your HOME directory.
Non-interactive shell
This shell runs by the system itself to run a shell script.
Users can customize the above-mentioned files to include environment variables, just edit the desired file and type the variable you want and save it.
原文链接