Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to have all users on the system to have an environment variable named SPI that points to /usr/local/share_ideas directory. How do I do it?

share|improve this question

I'd put it in the /etc directory in the file /etc/profile.d/myvariable.sh. In this file I'd set it like this:


Files in the /etc/profile.d directory are automatically sourced as part of a user logging into the system. The files that end in a ".sh" are used by the bash shell.

share|improve this answer
Why not in /etc/profile? Is there a specific reason that using /etc/profile.d files is better? – terdon Apr 29 '13 at 18:02
In case the /etc/profile get's updated as a result of an update to an RPM. This is a remote issue but better to leave the system level files alone so your changes don't get lost. – slm Apr 29 '13 at 18:06

Your Answer


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.