Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using the directions here to customize my CSH prompt. Here's what I'm using:

set prompt="\n%{\033[1;32m%}%m %{\033[36m%}${cwd}$ %{\033[0m%} "

First of all, the ${cwd} part isn't giving the full path to the directory I'm in, only the full path to the directory I'm in when .cshrc was sourced. How do I display the current directory?

Secondly, if I don't include the space at the end of the string the color of the text I type is changed to the color of the directory from the previous part. Is there anyway to do this without adding the space?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The following code solved both of my problems.

set prompt="\n%{\033[0;32m%}%n@%m:%{\033[0;33m%}%~%{\033[1;30m%}>%{\033\[1;37m%} "
share|improve this answer

In C Shell, add the following lines to your .cshrc:

make a command doprompt that sets the prompt to the working directory

alias doprompt 'set prompt="`pwd` "'

set the prompt the first time around

doprompt

alias the cd command to change directories and reset the prompt

alias cd 'chdir !* || doprompt'
share|improve this answer
    
The doprompt command works fine. However, the cd alias causes problems. When I add that alias to my .cshrc, when I type cd it says .cshrc: Not a directory. –  gsingh2011 Mar 11 '12 at 7:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.