Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2000 23:00:32 -1000
From:      "Randal Masutani" <randal@hits.net>
To:        Dru <genisis@istar.ca>, freebsd-questions@FreeBSD.ORG
Subject:   Re: Can't get ansi color codes to work with sc0 console
Message-ID:  <39948590.20415.64EB84@localhost>
In-Reply-To: <Pine.BSF.4.21.0008110817260.5420-100000@genisis.istar.ca>
References:  <399341E3.28197.49E6E6@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
<color><param>0100,0100,0100</param>On 11 Aug 2000, at 8:21, Dru wrote:


<color><param>7F00,0000,0000</param>> 

> 

> On Thu, 10 Aug 2000, Randal Masutani wrote:

> 

> > I am not able to get any ANSI color codes to 

> > work with the standard sc0 console since 

> > installing 4.1 release.

> > 

> > All other releases I had no problem.  Has anyone 

> > tried using something like:

> > 

> > set prompt="^[[1;33;41m[`whoami`]^[[1;37;40m "

> > 

> > All I get for the prompt is the exact same 

> > string between the quotes as shown above without 

> > any color.

> > 

> > Is there something new in RELEASE 4.1 that 

> > handles color ANSI code differently?

> 

> I had this same problem when I upgraded to 4.1 as I had saved my .cshrc

> file. Do a search through the manpage for tcsh for "ls_colors" to see the

> different syntax for tcsh. I've actually found it easier to use, just

> different.

> 

> Dru 


</color><FontFamily><param>Courier New</param>I checked the man page for tcsh.  However,  the

LS_COLORS env variable is used only for 'ls'

listings.  It does not apply to the 'prompt'

setting, which I am trying to use with color.


I did find out from the tcsh man page that the

prompt variable has a different syntax than csh.

The ESCAPE character needs to be enclosed between

%{ and %}.  This will treat the ESCAPE literaly.

Without these quotes the ESCAPE character is 
translated to the text ^[.<FontFamily><param>Arial</param>


<FontFamily><param>Courier New</param>So, the above example should be now as:

set 
prompt="%{^[%}[1;33;41m[`whoami`]%{^[%}[1;37;40m "


This works great, I now get color prompts.


Actually I use a little more fancy prompt:


set prompt="%{^[%}[1;33;41m[%n@%M:%~]%# 
%{^[%}[1;37;40m"


alias  cd  'cd \!*;set 
prompt="%{^[%}[1;33;41m[%n@%M:%~]%# 

%{^[%}[1;37;40m"'


Randal


<nofill>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39948590.20415.64EB84>