how to change parent environment?

mike.stefanik mike at bria.UUCP
Sat May 4 14:50:22 AEST 1991


In an article, njacobs at kong.gsfc.nasa.gov (Nick Jacobs - EOS) writes:
|How do you change the current working directory in a program, so
|that when the program is invoked from a shell, the cwd stays
|changed after the program exits?
|
|You can't do it with chdir(2) of course, because that only affects
|the current process.

Seems that you have answered your own question.  The current working
directory is unique to each process.  It is inherited in only one
direction -- parent to child. 

Yes, yes, you could go read the kernel namelist, search the proc table,
read and modify the u area of the parent.  Of course, it is unportable,
requires root privilege, subject to races with the kernel, and is
generally bletcherous.  So, that's not really an option -- is it?

-- 
Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
If MS-DOS didn't exist, who would UNIX programmers have to make fun of?



More information about the Comp.unix.programmer mailing list