3

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?

1
  • 1
    systemwide or per-user?
    – akira
    Sep 4, 2010 at 10:43

1 Answer 1

4

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

4
  • Did Lucid change /etc/profile from a file to a directory? Sep 4, 2010 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. Sep 4, 2010 at 18:39
  • @Dennis, No - /etc/profile file loads what is in /etc/profile.d directory
    – laurent
    Sep 4, 2010 at 18:40
  • @laurent: Yes, I know. It was a typo that threw me. Sep 4, 2010 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .