2002-08-19 22:26:20

by Venkat Raghu

[permalink] [raw]
Subject: newbie


Hi,

I have a bash script which modifies some environment
variables and does some other housekeeping things.
But problem is that when script finishes running,
new values of environment variables are no longer
visible in parent shell. So what should I do so that
these new values are visible in parent. I don't want
to run as ". file.sh". I have to run it as "file.sh"
only.

Kindly mail me at [email protected]

Regards
Venkat.

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com


2002-08-20 07:28:34

by Matti Aarnio

[permalink] [raw]
Subject: Re: newbie

On Mon, Aug 19, 2002 at 03:30:18PM -0700, Venkat Raghu wrote:
> Hi,
>
> I have a bash script which modifies some environment
> variables and does some other housekeeping things.
> But problem is that when script finishes running,
> new values of environment variables are no longer
> visible in parent shell. So what should I do so that
> these new values are visible in parent. I don't want
> to run as ". file.sh". I have to run it as "file.sh"
> only.

The things you do in child process environments are
inheritable only to their childs, never to parent.
If they were, there would be massive security problems,
just to mention one consequence...

If you want your current shell to get the new values,
you have to do: . file.sh

> Kindly mail me at [email protected]
>
> Regards
> Venkat.