Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running an application which requires setting environment variables to be set.

At the moment, the way I am achieving this is by exporting the EV at the command line, and then running the app from the command line.

I want to be able to run the app from my menu (it is already a menu item after I installed it).

How may I set the env var so that it is always available, so I can just run the app from the menu instead of from the CLI?

share|improve this question
1  
systemwide or per-user? –  akira Sep 4 '10 at 10:43

1 Answer 1

Add the environment variable declarations to the file .profile in your home directory:

export NAME='value'

If there are single quotes in the value, replace them by '\'' (there are other quoting mechanisms, this one is just the simplest to explain).

If you want to make the variables available to all users, add the declarations to /etc/profile.d/my-app-environment.sh (replace my-app-environment by a more descriptive name).

share|improve this answer
    
Did Lucid change /etc/profile from a file to a directory? –  Dennis Williamson Sep 4 '10 at 15:03
    
@Dennis: no, I meant /etc/profile.d, thanks for pointing it out. Since at least Ubuntu 8.04 and Debian lenny, /etc/profile sources /etc/profile.d/*.sh. –  Gilles Sep 4 '10 at 18:39
    
@Dennis, No - /etc/profile file loads what is in /etc/profile.d directory –  laurent Sep 4 '10 at 18:40
    
@laurent: Yes, I know. It was a typo that threw me. –  Dennis Williamson Sep 4 '10 at 18:59

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.