You are not logged in.

#1 2007-11-02 02:27:32

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Color PS1 in runlevel 3 -how? [SOLVED\]

I have found this in the wiki to be pleasing to the eye: http://wiki.archlinux.org/index.php/Pos … p_your_PS1
But it only works in X terminal emulators, not in the runlevel 3 console. I do have colorized output from pacman and man pages in runlevel 3, using the same guide, but my PS1 is still dull white. How do I fix this?

Last edited by Misfit138 (2007-11-02 23:48:24)

Offline

#2 2007-11-02 03:20:15

Gilneas
Member
From: Netherlands
Registered: 2006-10-22
Posts: 320

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

I didn't know of this method, I do know of something like PS1="\[\033[31mfoobar\[\033[m ".

Offline

#3 2007-11-02 15:33:40

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

Use ANSI-color codes instead of that weird thing that they do in that wiki-entry. (as Gilneas kind of mentioned too)

Offline

#4 2007-11-02 15:50:34

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

hybrid wrote:

Use ANSI-color codes instead of that weird thing that they do in that wiki-entry. (as Gilneas kind of mentioned too)

Also remember to use \[ at the beginning and \] at the end of each color string.  Otherwise, bash will miscount the number of characters displayed in a prompt, and wrapping will be weird:
\[\e[1;33m\]\w>\[\e[0m\]

Another thing to remember is, xterm kills your PS1 prompt so you have to reload it every time you open an xterm session.

To that end, I put my PS1 definition in ~/.bashrc and make sure that the logon script /etc/profile calls ~/.bashrc.  That way PS1 is defined both when I first log on to the TTY console, and every time I open an xterm window.


Peter B. Steiger
Cheyenne, WY

Offline

#5 2007-11-02 23:48:02

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

Thanks to all. Got it working perfectly now. big_smile

Offline

#6 2007-11-03 01:02:38

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

Added to the wikipage:
http://wiki.archlinux.org/index.php/Col … 7s_Prompts
Try them out. Enjoy! big_smile

Offline

#7 2007-11-03 01:37:59

Gilneas
Member
From: Netherlands
Registered: 2006-10-22
Posts: 320

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

My PS1 is "--> ", and I love it tongue

Offline

#8 2007-11-03 02:09:03

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Color PS1 in runlevel 3 -how? [SOLVED\]

Hehe. Minimalism is good. tongue

Offline

Board footer

Powered by FluxBB