Getting UNIX prompt to display current directory (Answers)

Russell Gilbert gilbert at necbsd.NEC.COM
Tue Mar 21 05:09:10 AEST 1989


>From article <2455 at lindy.Stanford.EDU>, by news at lindy.Stanford.EDU (News Service):
> ) In MS-DOS there is a very easy way to get the current directory displayed as
> ) part of the prompt  (prompt $p).  In UNIX, there is certainly no
> ) straightforward way to do this.  Can anyone think of a tricky way? 

In K-shell, in my .profile, I use:     PS1='$PWD> '

In C-shell, in my .login, I use:

   if ($?prompt) then
      set X=`pwd`
      set prompt="$X>C> "
   alias cd 'cd \!*; set X=`pwd`; set prompt = "$X> "'

RG



More information about the Comp.unix.questions mailing list