You are not logged in.

#1 2010-02-28 14:52:58

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

[solved] flaw in PS1?

Hey,
my PS1 for root isn't working like i want it to.
It breaks lines and places previous commands in front of new ones, if i skim through the history with down or up arrows.
Any idea what's wrong with my .bashrc?

# Check for an interactive session
# .bashrc root
[ -z "$PS1" ] && return

alias ls='ls --color=auto'
LS_COLORS='no=00:fi=00:rs=0:di=04:ex=00:';
export LS_COLORS
PS1='\t \W \e[31m# \e[0m'
PS2='\\ '

An example picture:
32zqgxg.jpg

Thanks.

Last edited by demian (2010-02-28 16:53:19)


no place like /home
github

Offline

#2 2010-02-28 15:41:42

quarkup
Member
From: Portugal
Registered: 2008-09-07
Posts: 497
Website

Re: [solved] flaw in PS1?

its not a flaw.

actually you need to tell that the color commands occupy no space - do it by using the escape character \e

check how to here: http://wiki.archlinux.org/index.php/Color_Bash_Prompt


for example, my $PS1 is the following:
\[\e[1;32m\]\A \[\e[0;01m\] \u\[\e[1;31m\]@\[\e[0;01m\]\h \[\e[1;31m\]\W\[\e[1;36m\] $\[\e[0;00m\]

edit:

just for you to notice: use the \[\e <color_here> \]

wink

Last edited by quarkup (2010-02-28 15:54:07)


If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Simplicity is the ultimate sophistication.

Offline

#3 2010-02-28 16:05:09

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [solved] flaw in PS1?

I have a similar problem even with a non-color PS1:

850670442screenshot1267373241.png

Last edited by anonymous_user (2010-02-28 16:06:06)

Offline

#4 2010-02-28 16:21:38

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [solved] flaw in PS1?

anonymous_user wrote:

I have a similar problem even with a non-color PS1:

That's not a problem with your prompt. There's no newline character on the end of that output so your prompt is appended directly to the end of STDOUT. "Working as intended."

Offline

#5 2010-02-28 16:33:18

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [solved] flaw in PS1?

Ok thank you.

Offline

#6 2010-02-28 16:52:45

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: [solved] flaw in PS1?

Thanks, quarkup. It's working now.


no place like /home
github

Offline

Board footer

Powered by FluxBB