bash prompt colours problem
bash prompt colours problem
am 11.04.2008 03:56:33 von foudfou
Hello people,
i can't find a solution to this problem :
in my .bashrc, I have :
PS1="\[\033[7m\]\h:\w>\[\033[0m\] "
witch works very fine, except if I have an output without any \n :
ip-151:/tmp> echo -n FOO
ip-151:/tmp> p>
ip-151:/tmp> echo FOO
FOO
ip-151:/tmp>
It's a bit annoying... Have you had this problem ?
Re: bash prompt colours problem
am 11.04.2008 10:58:31 von Bill Marcum
On 2008-04-11, foudfou wrote:
>
>
> Hello people,
>
> i can't find a solution to this problem :
>
> in my .bashrc, I have :
>
> PS1="\[\033[7m\]\h:\w>\[\033[0m\] "
>
> witch works very fine, except if I have an output without any \n :
>
> ip-151:/tmp> echo -n FOO
> ip-151:/tmp> p>
>
> ip-151:/tmp> echo FOO
> FOO
> ip-151:/tmp>
>
> It's a bit annoying... Have you had this problem ?
You could begin your prompt with \n.
Re: bash prompt colours problem
am 11.04.2008 12:22:54 von Matteo Corti
Dear foudfou,
On Apr 11, 3:56 am, foudfou wrote:
> i can't find a solution to this problem :
>
> in my .bashrc, I have :
>
> PS1="\[\033[7m\]\h:\w>\[\033[0m\] "
>
> witch works very fine, except if I have an output without any \n :
>
> ip-151:/tmp> echo -n FOO
> ip-151:/tmp> p>
>
> ip-151:/tmp> echo FOO
> FOO
> ip-151:/tmp>
>
> It's a bit annoying... Have you had this problem ?
Not really with my bash (GNU bash, version 3.2.33(1)-release (i386-
redhat-linux-gnu)) it works as expected:
$ export PS1="\[\033[7m\]\h:\w>\[\033[0m\] "
matteo:~> echo FOO
FOO
matteo:~> echo -n FOO
FOOmatteo:~>
why version/platform are you using?
Matteo
Re: bash prompt colours problem
am 11.04.2008 15:28:28 von foudfou
Thank you for your answers.
Bill, your solution works. But I'd rather have no "\n" in my prompt.
Matteo, my version is : GNU bash, version 3.1.17(1)-release (i486-pc-
linux-gnu)
which comes with the standard debian/lenny distribution.
By the way, i'm using bash in "GNOME gnome-terminal 2.22.0", but I get
the same weird behaviour with xterm (XTerm(232)), or in the console !
also, I tried the following : export PS1="\e[07m\h:\w>\e[00m "
which works :
ip-151:~> echo -n FOO
FOOip-151:~>
but always writes on the same line instead of going to the next -
wrapping problem [I hope that's understandable...]
I have a small .inputrc :
set convert-meta on
M-p: history-search-backward
M-n: history-search-forward
and I did't notice anything special in /etc/profile or /etc/
bash.bashrc
I'll try with a newer version of Bash...
Re: bash prompt colours problem
am 11.04.2008 15:36:25 von Joachim Schmitz
foudfou wrote:
> Thank you for your answers.
>
> Bill, your solution works. But I'd rather have no "\n" in my prompt.
>
> Matteo, my version is : GNU bash, version 3.1.17(1)-release (i486-pc-
> linux-gnu)
> which comes with the standard debian/lenny distribution.
>
> By the way, i'm using bash in "GNOME gnome-terminal 2.22.0", but I get
> the same weird behaviour with xterm (XTerm(232)), or in the console !
>
> also, I tried the following : export PS1="\e[07m\h:\w>\e[00m "
> which works :
>
> ip-151:~> echo -n FOO
> FOOip-151:~>
>
> but always writes on the same line instead of going to the next -
> wrapping problem [I hope that's understandable...]
What else do you expect, if you explictly for bid echo to produce a new line
and don't want to do it in the prompt itsaelf?
> I have a small .inputrc :
>
> set convert-meta on
> M-p: history-search-backward
> M-n: history-search-forward
>
> and I did't notice anything special in /etc/profile or /etc/
> bash.bashrc
>
> I'll try with a newer version of Bash...
Don't think this would help.
Bye, Jojo
Re: bash prompt colours problem
am 11.04.2008 16:43:26 von foudfou
Hello Jojo,
that behavior I expect is exactly the one which is described by Teo :
matteo:~> echo -n FOO
FOOmatteo:~>
Maybe I wasn't clear about the problem : I have a prompt with colours,
and sometimes programs print something to stdout or stderr, but
without "\n". In this case, what I expect is the output, followed by
my shiny colored prompt. But what I get is that the output is not
printed, it seems overridden by the prompt. That's probably my config,
but I'm trying to figure out what/where is the problem.
Re: bash prompt colours problem
am 11.04.2008 19:24:10 von foudfou
upgrading to bash-3.2 solved the problem.
Thank you all.