`pwd` in Shell prompt

Mark Humphrys H235-017%IRLEARN.BITNET at cunyvm.cuny.edu
Fri Apr 1 10:28:49 AEST 1988



Calling Unix hackers,

  Forgive me if this is an absurdly easy question but I am pretty new to Unix.
I want to get the current directory to be automatically included in the Shell
prompt.
  Now
          $  PS1="`pwd` > "
works, but you have to type this in every time you change directory - not much
use. Alas, in my naivety, I thought that the following program would change
directory for me and change the prompt at the same time :

             cd $1
             PS1="`pwd` > "
             export PS1

but it does absolutely nothing. The reason appears to be that a subprocess
cannot alter its parent process.

Is there any way around this? How does the Unix programmer/hacker survive
without having a constant reminder of what directory he or she is in?

Again, forgive me if this question is ridiculously easy. You can reply to me
in person if you want, and we can have a good laugh about it.


Mark Humphrys
h235-017 at Irlearn
" Humanity I love you because when you're hard up you pawn your
intelligence to buy a drink."



More information about the Comp.unix.questions mailing list