LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Exporting a variable from within .xsession (http://www.linuxquestions.org/questions/linux-newbie-8/exporting-a-variable-from-within-xsession-872124/)

mike11 03-31-2011 06:31 AM

Exporting a variable from within .xsession
 
Hi All,

I'm trying to export a variable from within the .xsession so it will be available to any application started afterwards.

Here is a minimial .xsession file:
Code:

export MYVAR=123
exec gnome-session

The problem is that when I start a terminal and do:
Code:

echo $MYVAR
I get an empty string, meaning it's undefined.

TIA.

David the H. 03-31-2011 06:58 AM

Your shell doesn't read the .xsession file, which I believe is only for the gui environment. You'll have to set the variable separately in your bashrc or whatever you use.

For bash, see the INVOCATION section of the man page for which files it reads.

mike11 03-31-2011 07:48 PM

Thanks. I'm not sure this is related to the shell (bash or something else). Basically what I want is to export a variable from within .xsession so it will be available, let's call it globally, to every application started afterwards.


All times are GMT -5. The time now is 10:13 AM.