Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rochester!uhura.cc.rochester.edu!ctne_ltd From: ctne_ltd@uhura.cc.rochester.edu (Chris Newbold) Newsgroups: comp.unix.questions Subject: Re: Prompt as Current Directory? Message-ID: <4116@ur-cc.UUCP> Date: 17 Nov 89 16:09:01 GMT References: Reply-To: ctne_ltd@uhura.cc.rochester.edu (Chris Newbold) Organization: University of Rochester Lines: 26 In article broadman@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@uhura.cc.rochester.edu * uhura.cc.rochester.edu!ctne_ltd@uunet