On Thu, Jan 16, 2003 at 08:58:22PM +0100, Konrad Foerstner wrote:

> I need to get a value from an environment variable VALUE. This value is
> set by an shell script which location is stored in anonther environment
> variable called SCRIPT. So I first call the shell script by
> 
> `. \$SCRIPT`;
> 
> and extract then the value of VALUE by
> 
> my $value = $ENV(VALUE);
> 
> But something does not work, so $value is empty. As the shell script
> produces also an echo output I catch it by using
> 
> my @output = `. \$SCRIPT`;
> 
> I get this output correctly, but VALUE is still empty! I also tried also 
> 
> system(\$SCRIPT`); 
> 
> and 
> 
> `. /place/of/my/shellscript.sh`;
> 
> Both don't have the wished effect.
> 
> When I call the shell script in the shell and the start my perl script
> VALUE is set and available for my perl script.
> 
> What is wrong?

Unfortunately, your understanding of processes.  A child process cannot
alter the environment of its parent.

Take a look at Shell::Source on CPAN.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to