Shell environment variables.

I have two shells one is the parent and one is the child.
Is it possible to change from the child an environmental variable of the parent?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The short answer is "no"

In UNIX two separate processes have completely protected variable spaces.  Facilities are provided for programmers to enable the activity you are asking for.  The facilities are called "Inter Process Communication" or IPC.

There are many ways for processes to exchange informaiton, but typically modifying each other's variables is not one of them.  For example, in scripts "Command Substitution" enables the output of a child program to be captured by the parent, and it typically assigned to a variable.  That is the normal method of passing informaiton from child to parent.  Other techniques include disk files, named pipes, and semaphores.

If you describe the problem you are trying to solve, there may be a preferred technique we could recommend.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anacletoAuthor Commented:
I don't have any problem in this, it is just a curiosity.

yes,you can set the variables of a parent shell available to you in your new shell.for instance at your bourne shell if you give
it just sets the term type then if this is followed by "export" command as shown below it can be exported(applied to your new shell)
bash$export TERM
Now suppose you give
bash$ sh
$echo $TERM
try it out.

anacletoAuthor Commented:
For vvenkks:The problem is the opposite.
I've asked to change a parents variable from the child, not viceversa.

Ozo, if you want the points ,make a question, you was the first...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.