IT-Service Faculty of Physics

Language Selection

Breadcrumb Navigation


Bash - which initialization file?

To decide when and which initialization files should be executed, one first has to distinguish between three kinds of invocation :

  • login shell
  • interactive shell (non-login)
  • non-interactive

Please keep this in mind when making the distinction:

  • login via ssh and text console: login shell
  • login via graphic interface: interactive shell
  • invocation via shell script: non-interactive shell

Invocation of the scripts:

  • login shell: .bash_profile
  • interactive shell: .bashrc
  • non-interactive shell: neither of the two; instead, the file specified in BASH_ENV will be read in

If you want your .bashrc to be executed both with login shells and interactive shells, write a .bash_profile file containing:

source $HOME/.bashrc

However, you should never execute this in .bashrc, as this would create an infinite lope.