Prompt showing current directory (just like DOS)
Robert L. Fair
cim2 at pyuxv.UUCP
Wed Nov 27 01:08:28 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")
The lines should be put in your '.kshrc' file or equivilent, and
THE ORDER IS SIGNIFICANT.
This works because "ksh" evaluates aliases before builtins/functions.
Note that although the function is called 'ncd' (to avoid conflict
with the built-in 'cd'), the alias allows one to still
do "cd $HOME" etc:
function ncd {
alias cd=cd
cd $1
PS1="! $PWD >"
alias cd=ncd
}
alias cd=ncd
PS1=$PWD
Since everthing here is a built-in, the speed is comparable to a regular 'cd'
Anyone know how to get a constant time display in the prompt also ???
Robert L. Fair
Bell Communications Research/ C.H.C
Piscataway
N.J.
(pyuxv!cim2)
>>> To Boldly love a maniac linguist, is that not a thing of beauty ????
More information about the Comp.unix.wizards
mailing list