free hit counter

Wednesday, March 23, 2005

a colorfull $PS1

I lost my old .bashrc with it's nicely colored prompt. So it took me awhile to find the color codes and combinations I liked.

Also, it screwed me up that I was incorrectly typing a two character sequence for the < ESC > character ^[ as opposed to the correct ascii 0x1b character you can get by hitting < CTRL > - q < ESC > in an XEmacs buffer(or should I say [C-q][M]).

My final prompt:

USER_AT_MACHINE_BLUE_ON_WHITE='^[[47;34m\u@\h^[0m'
DIM_WORKING_DIR='^[[02m\w^[0m'
BRIGHT_SHELL_CMDS_ON_NEXT_LINE='\n$ ^[01m'
export PS1="$USER_AT_MACHINE_BLUE_ON_WHITE $DIM_WORKING_DIR $BRIGHT_SHELL_CMDS_ON_NEXT_LINE"


A nice color table is linked below:
ANSI/VT100 Terminal Control

Set Display Attributes

Set Attribute Mode <ESC>[{attr1};...;{attrn}m

Sets multiple display attribute settings. The following lists standard attributes:

0 Reset all attributes
1 Bright
2 Dim
4 Underscore
5 Blink
7 Reverse
8 Hidden

Foreground Colors
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White

Background Colors
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White"

0 Comments:

Post a Comment

<< Home