Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So when I invoke emacs from the terminal, all my environment variables are loaded correctly from .bashrc. However, when I load emacs from the Ubuntu Application menu (by invoking the /usr/share/applications/emacs24.desktop) it loads no environment variables. Can I adjust the desktop setting to do so?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

.bashrc is not the right place to define environment variables, as you've discovered. This file is only read when you start an interactive shell (specifically, only when you start an interactive instance of bash, not of other shells). The environment is then inherited by the processes started from that shell (each process has its own environment, inherited from its parent process). So if you start a program directly from the GUI, it never had a chance to see these environment variables.

Define environment variables in ~/.profile or in ~/.pam_environment. Both files are read when you log in.

For more information, see Alternative to .bashrc and What's the best distro/shell-agnostic way to set environment variables?

share|improve this answer
    
thanks this worked –  octi Sep 11 '13 at 13:00
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.