[Top][All Lists]

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

bash prompt misbehaving - correction.

From: Chris Jones
Subject: bash prompt misbehaving - correction.
Date: Tue, 30 Jun 2009 04:45:21 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

Not sure whether this is a bug in my version of bash, but I copied over
my colored PS1 prompts from debian etch - regular user & root - and some
convenient keyboard actions are misbehaving. After retrieving a command
from the history via a CTRL-R, an ensuing CTRL-A moves the cursor to
somewhere in the middle of the prompt and CTRL-E is short of the
retrieved command's end by some ten characters.

The main difference between debian etch and debian lenny in this respect
appears to be that the default locale is now unicode (en_US.UTF-8).

I remember seeing other posts relative to this type of problem, possibly
on this list, but searching online, I could not find anything that
explained what is happening or provided a workaround/resolution.

Debian lenny has the following installed:

  $ bash --version
  GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu)
  Copyright (C) 2007 Free Software Foundation, Inc.

My guess is that the non-printable characters in my bash prompt that
switch colors interfere with bash's notion of the prompt's length? 

root's bash prompt is defined like so:

PS1="\[\033[0;41m\][\$(date +%T)][\u@\h:\w]\\$\[\033[0m\] "

I removed the color escape sequences from my user's bash prompt via a:

$ PS1="[\$(date +%T)][\u@\h:\w]\\$ "

.. and now everything is back to "normal".

Seems to confirm my above speculations.

In any case it's just a minor annoyance that I can live with for now,
but all the same, I would be grateful if anyone could provide some
useful pointers to documentation or bug reports that would help
understand what is happening, and possibly a workaround. 

If this is really a bug in the version of bash that I am running, I will
eventually upgrade to a version of bash where the issue is fixed, so
please let me know if this an option.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]