home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!rutgers!ub!toz!rchandra
- From: rchandra@toz.buffalo.ny.us (Dr. R. Chandra)
- Newsgroups: comp.unix.wizards
- Subject: Re: cd'ing to a dir from
- Message-ID: <gate.HwaJqB1w165w@toz.buffalo.ny.us>
- Date: 3 Sep 92 16:41:52 GMT
- Lines: 31
- X-Maildoor: WaflineMail 1.00r
-
- > hurtta@cs.Helsinki.FI (Kari E. Hurtta) writes:
- >
- > >In article <BtA89y.MCt@encore.com> mpalmer@encore.com (Mike Palmer)
- > wrote:
- > >> Can anyone suggest a way for a process to cd to a dir & stay there
- > >> when the process exits.
- >
- > >So program must modify its parent's environment ...
- > >That's magic.
- >
- > Yesterday I tried out Norton's ncd for Unix (please no more flame wars
- > on
- > this topic), and it works. But how? I didn't look whether ncd was suid
- > root, but how else can the program mess around in the environment? Or
- > is
- > this on of the kernel changes Norton Utilities for Unix requires?
-
- Hmmmm....can't tell you for sure. But if you think about it, the
- inheritance rules for exec(2) should work. The shell that invokes ncd
- by exec(2) instead of fork(2)/exec(2), and then ncd can exec(2) either
- another program, or its invoking shell program, which ONLY BY CONVENTION
- is in the environment variable SHELL (the invoking shell may or may not
- choose to pass the environment it got from its parent program (I realize
- this term is usually used for only processes...), usually login(1)).
- Ergo, let's for a moment assume csh. You can do
-
- alias ncd exec ncd
-
- or make it a Bourne function (if sh), or whatever.
-
- * Q-Blue v0.7 [NR] *
-