2

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
    systemwide or per-user? – akira Sep 4 '10 at 10:43
3

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

  • Did Lucid change /etc/profile from a file to a directory? – Paused until further notice. 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 'SO- stop being evil' 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. – Paused until further notice. Sep 4 '10 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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