Getting UNIX prompt to display current directory
Juergen Wagner
gandalf at csli.STANFORD.EDU
Sun Mar 19 20:11:45 AEST 1989
Ok, guys. It's prompt time again.
The answers to the question are:
(1) It depends on your shell (csh, sh, tcsh, ksh, ...).
(2) The trick is not to update the prompt after every command but only
after commands changing the current working directory. In csh, you
can alias cd, pushd, popd, etc., so they set the csh variable "prompt"
properly. In tcsh, you can specify something like
set prompt = "${HOSTNAME}:%d(%h)${dot} "
to include the proper working dir in the prompt. Your mileage may vary.
It should be all in TFM for your favourite shell.
(3) This question arises every 6 months or so, and promptly causes
prompt wars.
(4) Typically about a month after the original posting, after all variations
have been stated, somebody asks for a repost.
Enjoy,
--
Juergen Wagner gandalf at csli.stanford.edu
wagner at arisia.xerox.com
More information about the Comp.unix.questions
mailing list