Subject : Re: LUG: [SOLVED] Help me spot the problem with PS1 definition
From : Warren Myers <volcimaster@gmail.[redacted]>
Date : Wed, 21 Apr 2010 08:06:59 -0400
For those who may be interested, I found the flaw after reading
O'Reilly's "bash Cookbook"
This:
PS1='[\u@\[\e[0;31m\h\e[0m]\]:\W\$ '
Should be:
PS1='[\u@\[\e[0;31m\]\h\[\e[0m]\]:\W\$ '
EXPLANATION: "\e[0;31m" has to be enclosed within escaped brackets like
"\[\e[0;31m\]" because it's a non-printing character. Similarly,
"\e[0m]" must be enclosed within escaped brackets like "\[\e[0m]\]".
--
Daniel Underwood
North Carolina State University
Graduate Student - Operations Research
email: daniel.underwood@ncsu.[redacted]
phone: XXX.302.3291
web: http://www4.ncsu.edu/~djunderw/
Replies :