On Mon, 19 Feb 2007 23:28:08 -0800, ayoub890 <[EMAIL PROTECTED]>
wrote:

> I am running a perl script in a command inside make. I am trying to pass 
> an environment variable to perl, modify it inside perl and see it 
> changed inside make after returning from the perl script.
> 
> What is happening is that perl see the environment variable and tries to 
> modify it but make sees no change in the value of the environment 
> variable after return from the perl script.
> 
> Can someone tell me what I am doing wrong?

Environment variables don't work in the way you think they do. They're
not global. Each process has its own copy of the environment that is
inherited from its parent at the time the process is created.

If you change an environment variable in process A and then create a
new child process B, both will have the same value for the variable.
But now each process can change the variable separately: B's value
came from the value that A had at the time B started, but there's no
longer any connection between them.

If you want to pass a value back from the child to the parent then you
have to do it yourself, sending it back on standard output or storing
it in a file somewhere and having the parent read it.

-- 
Matthew Winn

Reply via email to