Alexey Eremenko wrote:
> On 4/26/07, Jay C Vollmer <[EMAIL PROTECTED]> wrote:
>> On Thursday 26 April 2007 11:15, Alexey Eremenko wrote:
>> > congratulations for this new feature in 10.3 !
>> > I really like it !
>> >
>> > 1. Who made it?
>> > 2. Where can I find documentation that allows me to change bash
>> > prompt? (colors, symbols, etc...)
>> > I know this is a bash-specific PS1/PS2 variables were changed...
>>
>> You can define your $PS1 variable in root's .bashrc file like this:
>>
>> export PS1="\[\e[31;1m\]\u# \[\e[0m\]"
>>
>> This line surns your text red(\[\e[31;1m\]) prints the prompt (\u$ )
>> then turns the text coloring off (\[\e[0m\])
>>
>> Other colors are likewise available using the
>> following codes:
>>
>> RED     "\e[0;31m]"
>> YELLOW  "\e[0;33m]"
>> PURPLE  "\e[0;35m]"
>> WHITE   "\e[0;37m]"
>> BLUE    "\e[0;34m]"
>> BLACK   "\e[0;30m]"
>> CYAN    "\e[0;36m]"
>> BOLD    "\e[1;1m]"
>> BLINK   "\e[5m]"
>> INVERT  "\e[7m]"
>> UNDRLN  "\e[4m]"
>> OFF     "\e[0;0m]"
>>
>> Almost certainly there are other ways to do this, but this is the
>> one that I know.  Perhaps others will share their methods.
> 
> Thanks a lot !
> 
> I'm considering adding this stuff to "Lessons for Lizards".
> 
> Is there any extra info on that?
> Why two numbers for colors ? What do they mean ?
> What the "m" mean on the color table?

The lines are ANSI escape sequences to get the colors. Here's a pretty good 
thorough
explanation of what you can do in a prompt:

http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html

One thing to not forget is to make sure you surround all these with the special 
sequence
saying to not count these characters as taking up room on the prompt line by 
using the
special "\[" and "\]" sequences to begin and end each of them. Otherwise, bash 
gets confused
and will wrap lines early. Note in the above link, how the colors are bracketed 
by these:

local GRAY="\[\033[1;30m\]"
local LIGHT_GRAY="\[\033[0;37m\]"
local CYAN="\[\033[0;36m\]"
local LIGHT_CYAN="\[\033[1;36m\]"
local NO_COLOUR="\[\033[0m\]"

(\033 and \e are equivalent).

-- 
Jonathan Arnold     (mailto:[EMAIL PROTECTED])
Daemon Dancing in the Dark, an Open OS weblog:
    http://freebsd.amazingdev.com/blog/

UNIX is user-friendly. It's just a bit picky about who its friends are.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to