Prompt as Current Directory?

Chris Newbold ctne_ltd at uhura.cc.rochester.edu
Sat Nov 18 03:09:01 AEST 1989


In article <Nov.16.00.56.12.1989.9985 at paul.rutgers.edu> broadman at paul.rutgers.edu (Alan Broadman) writes:
>
>I have a (hopefully) simple question. How can you get the UNIX prompt
>to always reflect the path to the current directory. Such a prompt
>would change with each 'cd ' command. In MS-DOS this is done by the
>command : 'prompt $P'. I think this would be most helpful, as
>otherwise, the prompt string is quite useless.

I tried to do the same thing, too.  Under Unix, however, it's a little
cludgy.  The problem I encounted when trying to insert the cwd variable into
the prompt string was that csh would always evaluate it *before* assigning
the prompt variable, resulting in a prompt that would display the current
directory at the time of startup.  The only way I found to get around it
was to use an alias to change directories and then change the prompt.  Try
this:

	alias cd 'chdir \!*; set prompt = "$cwd % "'

Hope this helps.


-- 
>>>> Chris Newbold <<<< * "If you fool around with a thing for very long you *
University of Rochester	*  		  will screw it up."		     *
Disclaimer: "All warranties expire upon payment of invoice."                
ctne_ltd at uhura.cc.rochester.edu * uhura.cc.rochester.edu!ctne_ltd at uunet



More information about the Comp.unix.questions mailing list