Korn Shell Question

TepperL lat at druil.UUCP
Fri Oct 31 01:07:37 AEST 1986


In article <22300001 at ntvax>, mike at ntvax.UUCP writes:
> 
> I have a Korn Shell question that perhaps someone can answer. I like to
> have as my system prompt my current path. When I use csh, I set up my
> .cshrc file with these entries:
>   
> set prompt = "! `pwd`}"  -- this establishes my prompt as my command number
> 			    and current path when i first initiate the shell
> 
> alias cd 'chdir \!:1; set prompt=\!\`pwd`}\'
> 			    this sets up my cd command to not only change
> 			    my working directory but to change the prompt.
> 
> I would like to have something similar to this in ksh but I'm not sure how
> to change PSx on the fly.

In the version of ksh we run here, all you have to do is add to
your .profile:

	PS1='$PWD} '

The Korn shell keeps the name of the current directory in the
shell variable PWD.  Also, note that you don't need to update
PS1 every time you chdir.
-- 
Larry Tepper	    {ihnp4 | allegra}!drutx!druil!lat	+1-303-538-1759



More information about the Comp.unix mailing list