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.

Can I use different color setting (foreground and font) for each of the window that I create?

share|improve this question

1 Answer 1

If you have a set of windows that you create when you start screen, you can put something like this into your .screenrc:

screen bash --init-file $HOME/.green
screen bash --init-file $HOME/.blue
screen bash --init-file $HOME/.red

The .red init file then contains:

# load standard bashrc file
. ~/.bashrc 

# set prompt and text color to red
export PS1="\e[0;31m[\u@\h \W]\$ \e[m "

A more general solution would use the WINDOW environment variable, which is set by screen when it creates a new window.

case $WINDOW in 
0)
   # red
   export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
   ;;
1) 
   # blue
   export PS1="\e[0;34m[\u@\h \W]\$ \e[m "
   ;;
*)
   # no specific color
   export PS1="[\u@\h \W]\$ "
   ;;
esac
share|improve this answer

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.