🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #199

Re: ksh prompt (PS1) and cd

#199
From: Jeff Conner
Date: Wed, 29 Jul 1992 17:26
23 lines
976 bytes
>"
>"Using ksh, how can one alias "cd" to change directory as well as
>"to set PS1 to $PWD.
>"
>"I tried:
>"alias cd="cd; PS1=$PWD" 
>"but didn't work.
>

PS1='$PWD $ '			export PS1

This will give you the current PATH in your prompt everytime you 'cd'.
e.g.,
		/usr $ echo $PATH	# current directory is /usr
		/usr
		/usr $ cd bin
		/usr/bin $ 		# notice prompt has changed

-- 
Jeff Conner   314-235-0274	|  uunet!swuts!jc8922
Southwestern Bell Telephone     |  -or- jc8922@swuts.sbc.com
One Bell Center	 23-K-07	|  
St. Louis, Missouri 63101-3099	| 
Technical Details
Message-ID: <1386@swuts.sbc.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!swbatl!texbell!swuts!jc8922
References: <l5n3efINN3g7@exodus.Eng.Sun.COM> <1992Jul21.132016.19391@cbnewsi.cb.att.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!swbatl!texbell!swuts!jc8922
From: jc8922@swuts.sbc.com (Jeff Conner)
Newsgroups: comp.unix.shell
Subject: Re: ksh prompt (PS1) and cd
Message-ID: <1386@swuts.sbc.com>
Date: 29 Jul 92 17:26:08 GMT
References: <l5n3efINN3g7@exodus.Eng.Sun.COM> <1992Jul21.132016.19391@cbnewsi.cb.att.com>
Distribution: ba
Organization: Southwestern Bell Telephone Company
Lines: 23