Current directory in the ksh prompt?

Rob Logie logier at cheops.qld.tne.oz.au
Mon Apr 29 09:47:27 AEST 1991


mju at mudos.ann-arbor.mi.us (Marc Unangst) writes:

>I realize this is probably a FAQ, but I can't seem to find the FAQ
>list on this machine or any of the NNTP servers around here (if you
>know of an NNTP server that accepts connections from anybody and keeps
>news a long time, like for over two weeks, please let me know!), so
>I'll ask away...

>I recently started using ksh, and one thing I miss dearly from csh is
>the ability to put the current directory in your prompt.  With csh, it
>can be done by aliasing the cd command to something that does the cd
>and then re-sets your prompt, using `pwd` to get the new directory.
>Unfortunately, it seems that you can't use the parameters inside an
>alias like you can in csh, so this trick doesn't work.  Is there a
>different trick for ksh, or am I just going to have to live with
>typing "pwd" all the time?

>--
>Marc Unangst               |
>mju at mudos.ann-arbor.mi.us  | "Bus error: passengers dumped"
>...!hela!mudos!mju         | 



Try

	PS1="`id -un`@`hostname`:"'$PWD'" $ "; export PS1

You will have to customise the id and hostname commands to what ever you
machine uses to return current user id and hostname.



-- 
Rob Logie                                    EMAIL: logier at cheops.qld.tne.oz.au
Telecom Australia                            FAX:   +61 7 837 4704
TNE Computer Support Services                PH:    +61 7 837 5174
Brisbane Office                              "These are my opinions alone"



More information about the Comp.unix.shell mailing list