in reply to environment variable

thank guys for your answers. a few things to clarify:
1. I'm running on Linux 7.1
2. I'm trying to update the variable LD_LIBRARY_PATH.
3. I'm using bash.
4. and another thing, the C program doesn't even load if it doesn't have this var.

I even tried eventually just for the test, to export LD_LIBRARY_PATH using backticks, like this:
`export LD_LIBRARY_PATH=/usr/local/lib`
And it still doesn't work. if I do that from the shell prompt, and execute the C program from there too, it works.
Any Ideas?

Hotshot

Replies are listed 'Best First'.
Re: Re: environment variable
by BMaximus (Chaplain) on Dec 28, 2001 at 00:34 UTC
    7.1 as in RedHat 7.1? system() should inherit your %ENV variables as said before. But if your C program requires that you input something and get something out of it then it might be more appropriate to use IPC::Open3.
    use strict; use IPC::Open3; $ENV{'LD_LIBRARY_PATH'} = '/usr/local/lib'; $COMMAND = '/some/c/proggie -w -options'; my ($read,$write,$error); my $pid = open3($read,$write,$error,$COMMAND); if ($pid) { # do stuff } else { # croak, bitch and complain }


    BMaximus