ksh PS1

Robert Viduya robert at gitpyr.UUCP
Sun Mar 17 23:31:18 AEST 1985


><
Posted from  jpage at rruxe.UUCP (J. H. Page)
> any unix-wizards out in net.land know how to have one's UNIX prompt change
> to reflect a change in one's working directory.
> 
> i have access to sh and ksh on our system.
> 

The trick here is to make the cd/chdir command change your prompt whenever
it's invoked.  I dunno about ksh, but SysVR2 sh won't let you and still be
able to retain the same name for the cd command.  The problem lies in the
fact that shell-builtins are searched first, then user-functions, then
$PATH.  This means there's no way to intercept-and-redefine the cd command.
Csh will let you because aliases are expanded before shell-builtins and path.  

It is possible, however, if you call your cd command something other than
'cd'.  This command would call cd to change your directory and then set
your prompt to the new directory.

			robert
-- 
Robert Viduya
Georgia Institute of Technology

...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert
...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert



More information about the Comp.unix.wizards mailing list