Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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).

share|improve this answer
1  
I see. The problem is when I start bash in Emacs, $PATH doesn't include everything I defined in .profile. But in one of your answers you suggest against adding such definitions in .bashrc, so what should I do? Thanks. –  hpy Sep 14 '11 at 23:36
2  
You should arrange for your .profile to be read when you log in. How to do that is very dependent on your operating system, login method, desktop environment, etc. Most do it automatically, but since yours doesn't you need to do some set up. So tell us about what your OS/DM/DE/… are. –  Gilles Sep 14 '11 at 23:45
1  
I am running Emacs 23.3 (which opens a bash window) under Mac OS X 10.6.8, and also the same thing (Emacs w/ bash) under Fedora 15 XFCE. Are the steps for those two very different? –  hpy Sep 15 '11 at 0:02
2  
@penyuan Yes, they're likely to be different, and you need to give even more information. On the Mac, is this Emacs running on X or on Aqua? On Fedora, in what display manager (if any) do you type your password (text mode, xdm, gdm, kdm, …)? (And I don't know the answer offhand in any case, I suggest asking new questions.) –  Gilles Sep 15 '11 at 0:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.