Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!ihnp4!cbosgd!clyde!burl!codas!usfvax2!jc3b21!jra
From: jra@jc3b21.UUCP (Jay R. Ashworth)
Newsgroups: comp.unix.wizards
Subject: The whole prompt string thing (was: Re: PS1 and the bourne shell...)
Message-ID: <207@jc3b21.UUCP>
Date: Fri, 27-Nov-87 01:46:27 EST
Article-I.D.: jc3b21.207
Posted: Fri Nov 27 01:46:27 1987
Date-Received: Mon, 30-Nov-87 00:48:49 EST
References: <279@caus-dp.UUCP> <1311@puff.wisc.edu> <137@anumb.UUCP> <9354@ufcsv.cis.ufl.EDU>
Organization: St. Petersburg Jr. College, FL
Lines: 33
Summary: this shouldn't really be that hard ...

In article <9354@ufcsv.cis.ufl.EDU>, esj@beach.cis.ufl.edu
  (Eric S. Johnson) writes:
> In article <137@anumb.UUCP> eao@anumb.UUCP (e.a.olson) writes:
> >	no - cd is done in the shell itself.    Not the kernel.
> >	Well, of course, everything interesting is done in the kernel;
> >					eric olson, ihnp4!mvuxq!eao
> 
> Well, not exactly. The concept of current working directory is very 
> much in the kernel of every unix system i've encountered. The shell 
> uses the chdir system call to tell the kernal to change it. 
> 
> The problem is that the (standard) bourne shell evaluates something
> like PS1=$CWD or PS1=`pwd` once. At the point it encounters it. What
> you need to do is modify it (bourne shell) to evaluate that variable
> each time it uses it. Best-o-Luck.
> Eric S. Johnson II   Internet: esj@beach.cis.ufl.edu University of Florida    

Well, now.  It seems to poor uneducated me that this shouldn't be quite
as hard as everyone seems to make it out to be.  Now, if I understand
the shell code correctly, considering that I've never actually *seen*
it, you understand, the only thing necessary here is to cause the
shell to parse the PS1 (and PS2?) strings just before it prints them.
Maybe for $variables and `back quoted commands`.  Granted now, folks,
this has the potential for causing peoples prompts to take a long time
to print, and all that, but personally, if I wan't to know a bunch of
slow-to-figure-out stuff everytime I get a prompt, I'm willing to
wait.  Or is there a big flaw here that I can't see?  Maybe if the
system is parsing your prompt string and it sees a SIGINT, it should
give up and just print "$"?  Or maybe there should be an option you
could set and unset?  I may get the chance to play with all this here
in a while, but if anyone can save me the trouble, go right ahead.

-- jra