LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-09-2005, 05:56 AM   #1
pulsez
LQ Newbie
 
Registered: Jan 2003
Distribution: Gentoo
Posts: 8

Rep: Reputation: 0
How to change environment variables of a parent envrionment from a child one.


I have the folowing scenario:

I login. This starts BASH, with the proper environment; let's call this enviroment MAIN ENVIRONMENT; it has the folowing variables definiton: x=x_main; y=y_main. Now i issue startx. Everithing it's fine, works as i expect. Now i start xterm for example. From this, I want to change a environment variable from MAIN ENVIRONMENT, without closing a sinle window, nor X. Is here any way to do this?

The problem is that i want to cahnge the enviroment variables, and the changes to be reflected in every new started application, this without loging out, closing a windows or something...
 
Old 11-09-2005, 06:24 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Each process has a copy of the environment, so you can't change variable values of the parent's and siblings' processes after the fact. You can use the .profile or .bash_login scripts to change variables in the future, or alter them where they are defined (such as in a script in /etc/sysconfig).

Some variables are re-evaluated on the fly using functions, and for other variables, you may need to restart a service so they can be loaded in again.

One example, is HOSTNAME. While there is a "hostname" command that will reflect a recent change in your configuration, KDE will not work properly until you log out and back in again.
 
  


Reply



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
GCC fork() - Can a child change a parent variable? johnhardey Programming 4 03-10-2005 10:49 AM
parent and child processes skora Programming 5 11-02-2003 10:41 AM
about parent and child process winwar Solaris / OpenSolaris 3 07-23-2003 06:07 AM
environment variables change in X Baloney Pete Slackware 1 01-19-2003 02:40 PM
Must change environment variables rw Linux - General 6 07-11-2001 11:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:18 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration