Index

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

Parent


Dan,

I hadn't seen the thread till you just replied, but the first issue I spotted was that brackets were opened and not closed. I don't know if I could've pointed you to the right spot to close them, but they're like parens and braces: you have to have as many closes and opens :)

-WMM

On Tue, Apr 20, 2010 at 20:48, Daniel Underwood < daniel.underwood@ncsu.[redacted] > wrote:
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/




--
Warren Myers
http://warrenmyers.com
http://www.linkedin.com/in/warrenmyers

Replies :