Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Customizing CSH prompt

Writer Mia Lopez

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?

2 Answers

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%} "
1

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'
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy