[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDL and UNIX setenv




In article <Pine.LNX.4.21.0106190817360.16998-100000@homer.atm.ox.ac.uk>, Randall Skelton <rhskelto@atm.ox.ac.uk> writes:
> > I think you might need to add the path to your default .profile/.login/.cshrc/.whatever
> > (which I am assuming you're not doing - I really can't tell from "I tried to append the
> > /usr1/guest/bin/ directory to my UNIX path before starting an IDL session")
> > 
> > I *think* when you use SPAWN, the subsequent shell in which the SPAWN command argument is
> > executed is *not* the one you started IDL in and therefore has no knowledge of what you
> > may have explicitly defined. The same sort of thing happens in make files in Unix. 
> 
> Paulv is indeed correct here.  Using spawn will start a *new* process
> (with a unique pid) and therefore it does not interact or have any
> knowledge of the shell or environment variables you had when you started
> IDL.  

That's not quite right. When a new process is started it gets the same environment
as its parent (that's the purpose of environment variables in contrast to "normal"
variables). When you exec another executable with exec() or execl() it will still 
have the same environment. You can use execvp(), execlp() and pass it a different 
environment if required.

If the process created exec's a shell which invokes a startup script such as .profile,
.cshrc, .login etc which has hardcoded environment settings in it (e.g. path=/adf:/dea)
then this will override the environment passed down from the parent.


-- 
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    nmw@ion.le.ac.uk 
Phone :     +44 (0)116 2523568, Fax : +44 (0)116 2523555