current pwd in prompt

Norm Strong strong at tc.fluke.COM
Wed Feb 17 07:15:30 AEST 1988


In article <1981 at ho95e.ATT.COM> wcs at ho95e.UUCP (46323-Bill.Stewart,2G218,x0705,) writes:
>:In article <11656 at brl-adm.ARPA> Mensing.HENR801c at Xerox.COM writes:
>:|>Can anyone explain to me how to get my prompt to be the current directory? I
>:|>have tried several methods without any success. It seems that no matter what
>:|>method I try, the prompt is evaluated once and never changes.
 

If you use the c-shell, you can do it the way I do:

alias cd 'chdir \!*; set prompt= "^[[7m $cwd:t ^[[0m> "; ls -aF'

Put this line in your .cshrc file and the set prompt command in your .login
file.  Every time you change directories the prompt will follow.  It is not
foolproof since it will not work if you use the chdir command to change
directories.

Incidentally the garbage around the $cwd:t is to direct my VT-100 to use
reverse video and can be eliminated if a simple prompt is adequate.


-- 

Norm   (strong at tc.fluke.com)



More information about the Comp.unix.questions mailing list