[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ANSI Color Escapes in $PS1.. heh.

Ryan King wrote:
> Just how stupid an idea did I have when I did this:
> $PS1="[\e[31m\h\e[m:\e[34m\u\e[m:\e[31m\w\$\e[m]"
> in my /etc/profile?
> It looks really nifty until I try to do commands that wrap around, in which
> case the first line returns, but keeps going on the current spot.
> The real disaster, however, occurs when I get into the command buffer...
> each time I hit the left arrow, it smears about half the command up a line.
> Does bash figure its wraps like so?:
> if ( length($PS1) + length($input) > $screen_width ){ print "\n"; }
> Because if so, I understand why it is doing what it's doing.
> I'm mainly curious, but it makes the whole command-line experience easier
> for my newbie eyes when the prompt is in color.

Your problem is not color-specific.  I get the same symptoms when I have
PS1 set to [\u@\h:\w]$

Anybody have a fix for this?


BTW - There was a neat program called bashprompt on Freshmeat, but
last I checked the site that hosted it was down.  Anyone have a
copy to email to me?

Attachment: pgpDBWsjcExWc.pgp
Description: PGP signature

Reply to: