LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   help a newbie with system wide environmental variables, please (https://www.linuxquestions.org/questions/linux-newbie-8/help-a-newbie-with-system-wide-environmental-variables-please-937564/)

chuck1005 04-01-2012 12:38 PM

help a newbie with system wide environmental variables, please
 
Hi,
I am taking my first Linux class and given the following assignment:

"All users on the system are to have an environmental variable that points to the /usr/local/share_ideas directory. the name of the environmental variable is SPI(for SharePoint Ideas folder). Every user on the system will have this environmental variable, regardless of weather they are on the SharePoint project or not."

I have done Environmental variables in bash and I think it is:
SPI=/usr/local/share_ideas

Then I thought that that would have to be added to /etc/profile, saved and reboot my system.

I did that and with echo $SPI, I get nothing back.

any help or explanation of what I am doing wrong would be helpful.

thanks,

Chuck'

grail 04-01-2012 12:45 PM

I would suggest looking at some of the other variables set either their or in your .bashrc file and see what else you might be required to do for it to take affect.

chuck1005 04-01-2012 01:07 PM

do I need to write a script in /etc/profile? Is SPI=/usr/local/share_ideas the correct variable for what is being asked? this entire question seems to have me stumped and not finding much online as crazy as that sounds.

thanks again,

Chuck

sysfce2 04-01-2012 01:22 PM

Code:

export SPI="/usr/local/share_ideas"

grail 04-02-2012 01:08 AM

Well it seems sysfce has thrown in the spoiler, but imagine /etc/profile as a script. When you set the variable it only lives inside the script. Therefore, as demonstrated by sysfce,
you need to export it so the environment is made aware of it :)


All times are GMT -5. The time now is 11:57 PM.