Bash – Load the .profile for bash in Emacs terminal buffer? (multi-term mode)

bashemacsprofileterminal

I've got multi-term mode (derived from ansi-term) with bash started in Emacs 23.3, which is a terminal emulator running in Emacs.

However, I noticed that it did not load my user profile, including environment variables, $PATH, etc.

How do I tell multi-term to start bash with my user profile in ~/.profile?

Thanks.

Best Answer

Your .profile should be loaded when you log in, not in each terminal. Its purpose is to define environment variables and other settings for the whole session (including your window manager and any program you start from it such as Emacs). It's normal that ~/.profile isn't read when you start a terminal: it's rare to need to define environment variables then. Your shell has an initialization file (.bashrc or .zshrc or similar file), usually used to define functions and aliases and set shell options.

On .profile, its cousins and how they are loaded, read this answer and the ones I link to. All systems have a way to set environments variables when you log in, but there is some variation as to how (a lot of environments read .profile, but some such as yours don't).

Related Question