Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!olivea!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.shell Subject: Re: Help with this script Message-ID: <1991Apr10.223658.10955@convex.com> Date: 10 Apr 91 22:36:58 GMT References: <1991Apr9.164257.9128@agate.berkeley.edu> <1991Apr9.175008.12044@leland.Stanford.EDU> <1991Apr10.140153.480@cca.vu.nl> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 22 Nntp-Posting-Host: pixel.convex.com From the keyboard of hendrik@cca.vu.nl (Hendrik te Winkel): :Is it really impossible :to change your working dir with a shell script _and_ to remain there :after it is finished? I don't know how to do it. Please inform. This could be rephrased "Is it really impossible to change another process's environment without that process's cooperation?". This answer is generally, yes, this is really impossible. There are a few exceptions. If it's your own process, you may be able to change its nice value or send it a signal, but you're not going to be able to change its environment variables, its umask, or its working directory. Well, modulo a kernel dive: with kmem write privs, you could munge that process's u_cdir or u_cmask while it's not looking, but don't tell anyone I said that. :-) Much better solutions involve using shell aliases or functions, since they operate in the same process as the calling shell. A less good solution would be to use TIOCSTIs if you have them to jam the right command into your input buffer so that it's the next thing that your shell reads. --tom