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?
Linux – Permanent Environment Variable for all users
environment-variableslinux
environment-variableslinux
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?
Best Answer
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.