Prompt showing current directory (just like DOS)

Martin Stanley mts at ms.UUCP
Mon Dec 2 13:23:07 AEST 1985


> One of the (few) nice things about PC-DOS is that you can set 
> your prompt (PS1) to always show your current directory.
> 
> The following little script allows you to do the same thing
> in the Korn shell ("ksh")
> 

Well, here's how I did just that under the csh on a UniPlus+ port
(System Vr1). It is obviously slower than under BSD since the cwd
variable there is maintained by the shell.


set CWD = `pwd`
set prompt="($CWD) "
  
alias cd chdir \!\* \; set CWD=\`/fast/pwd\` \; set prompt = \"\(\$CWD\) \"


While we are at it, I also have a simulation of pushd and popd (from the
BSD4.2 csh). They are implemented via aliases and shell files. They too,
are considerably slower than the builtin versions, but work fast
enough.  Send me mail if you want a copy.
-- 

 Martin Stanley
 Department of Computer Science
 University of Toronto
 Toronto, ON
 M5S 1A4

 USENET:	{decvax,ihnp4,linus,uw-beaver}!utcsri!utai!ms!mts
 CSNET:		mts at toronto
 ARPANET:	mts.toronto at csnet-relay



More information about the Comp.unix mailing list