[comp.unix.questions] Re^2: Getting UNIX prompt to display current directory

maart@cs.vu.nl (Maarten Litmaath) (03/23/89)

connet@sal50.usc.edu (David Connet) writes:
\...
\Actually you can just get away with
\	PS1="\$PWD: "
\        ^
\The backslash is required.  The shell (at least ksh) then reevaluates
\the PS1 each time.

Precisely! *ksh*, not sh.
-- 
 Modeless editors and strong typing:   |Maarten Litmaath @ VU Amsterdam:
   both for people with weak memories. |maart@cs.vu.nl, mcvax!botter!maart

morrell@hpsal2.HP.COM (Michael Morrell) (03/29/89)

/ hpsal2:comp.unix.questions / lbn@ksuvax1.cis.ksu.edu (Lars Bo Nielsen) /  7:52 am  Mar 27, 1989 /

You are right. Here are the modified (quicker) versions:

2) Only name of current dir:
	alias cd 'cd \!*; set foo=$cwd; set prompt=$foo:t"% "'
3) Include name of machine in prompt
	alias cd 'cd \!*; set prompt=$host":"$cwd"% "'
or	alias cd 'cd \!*; set foo=$cwd; set prompt=$host":"$foo:t"% "'
----------

  I don't think you need the extra variable foo.  "set prompt=$cwd:t" works
just fine.

     Michael