LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-31-2011, 06:31 AM   #1
mike11
Member
 
Registered: Apr 2009
Posts: 222

Rep: Reputation: 17
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.
 
Old 03-31-2011, 06:58 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
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.
 
Old 03-31-2011, 07:48 PM   #3
mike11
Member
 
Registered: Apr 2009
Posts: 222

Original Poster
Rep: Reputation: 17
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] exporting a variable defined inside a for loop musonio Linux - General 6 11-06-2009 08:10 PM
exporting variable in bash deathalele Programming 12 04-04-2009 01:24 PM
AWK a variable Ouptut to a new variable and using the new variable with the old one alertroshannow Linux - Newbie 4 02-16-2009 12:08 AM
Sed search for variable and delete entire line, but variable contains forward /'s Passions Programming 2 11-10-2008 03:44 PM
exporting one NFS folder to another NFS and exporting it.... stellarmarine1 Linux - Networking 3 09-20-2004 06:54 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration