LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is it possible to locate where an environmental variable is exported from? (https://www.linuxquestions.org/questions/linux-software-2/is-it-possible-to-locate-where-an-environmental-variable-is-exported-from-508257/)

laggerific 12-07-2006 12:15 PM

Is it possible to locate where an environmental variable is exported from?
 
Is there a way to check? Is there an order of precidence as to what will have the final say on what an environmental variable will be?

MensaWater 12-07-2006 12:46 PM

Order is /etc/profile and/or /etc/bashrc (global for all users) then $HOME/.profile and/or $HOME/.bashrc.

Of course each of these can source in other files that set variables. I worked on a system once where tracing it down once where when I was all done I found 5 levels of sourcing occuring because the .profile sourced a script which in turned sourced another which in turn source another and so on.

One way to figure it out might by adding a "-x" for debug to your .profile or .bashrc (you can try the /etc files but if anyone else logs in while you're testing they're going to be mighty confused by what they see).

laggerific 12-07-2006 12:55 PM

Ah yes...there was some sourcing in there...thankfully not too deep, but that takes care of that...thanks! :D


All times are GMT -5. The time now is 03:17 PM.