ksh prompt

Ron Heiby heiby at mcdchg.chg.mcd.mot.com
Fri Mar 8 08:35:47 AEST 1991


In article <7365 at mentor.cc.purdue.edu> asg at sage.cc.purdue.edu (The Grand Master) writes:
>WHY DO YOU WANT TO MAKE IT SO HARD?????
>The $PWD variable changes when you cd. 
>ksh provides for another eval of the prompt string before printing it,
>so all you have to do is quote the $ in $PWD like this:
>PS1="\$PWD ->"
>this will give you a prompt that includes the current directory and
>is dynamic - and it is alot easier than a whole bunch of
>kludged functions.

Yup.  I suppose that if all you want is the absolute pathname of your
current working directory, then all you have to do is something like
you suggest.  Of course, there are some long pathnames out there.  I
find on my system one that would give a prompt string (with your
suggestion) something like:

/src68/usr/src/cmd/sadmin/admin/menu/diagnostics/diskrepair/badtrack ->

That doesn't leave much room for typing a command!  Also, it doesn't
provide any of the other things that have been integrated into the
"monster" prompt that many people have found useful.
-- 
Ron Heiby, heiby at chg.mcd.mot.com	Moderator: comp.newprod
"Wrong is wrong, even when it helps you." Popeye



More information about the Comp.unix.shell mailing list