`pwd` in Shell prompt

D. Parrish parrish at nadc.arpa
Fri Apr 1 23:00:11 AEST 1988


Mark,

   You're gonna get a lot of abuse.  This question has been
asked on this mailing list three or four times already.  But
anyhow, Dave asked it last and he sent me the information he
got, so now I'll forward it to  you.  Hope this helps.

Denice
parrish at nadc.arpa


	From Dave_B._Mensing.HENR801c at Xerox.COM Thu Feb 11 14:03:04 1988
	
	
	
	Below you will find a summary of the 40+ responses I received.
	
	KSH:
		To set your PS1 variable to show the current path:
			PS1='$PWD '
	
		You can also try which removes the HOME directory from the prompt when I am in
	a subdirectory of my HOME directory.
			PS1='${PWD#$HOME/}: '
	
	
	CSH:
		To set your prompt variable to show the current path:
			set prompt="`pwd`"
			alias setprompt 'set prompt="`pwd`"'
			alias cd 'cd \!* ; setprompt'
			alias pd 'pushd \!* ; setprompt'
			alias popd 'popd \!* ; setprompt'
	
		You need to ensure that after any command which can change your directory, you
	reset the prompt.
	
	If you need more info please message me and I will try to help.
	
	
	
	I forgot to mention the following:
	
	KSH:	Insert the PS1=... stuff into your '.profile' file.
	CSH:	Insert the prompt=... stuff into your '.cshrc' file.
	
	Sorry about that!
	
		Dave Mensing
	
		mensing.henr801c at xerox.com
		(716) 427-6423
	



More information about the Comp.unix.questions mailing list