Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 1996 19:38:01 -0400 (EDT)
From:      "Adrian T. Filipi-Martin" <atf3r@stretch.cs.virginia.edu>
To:        David <btjones@email.njin.net>
Cc:        "freyes@i-2000.com" <Francisco.Reyes@i-2000.com>, FreeBSD questions mailing list <questions@freebsd.org>
Subject:   Re: colored prompts in BASH
Message-ID:  <Pine.SUN.3.90.960513191924.5192A-100000@stretch.cs.Virginia.edu>
In-Reply-To: <Pine.SUN.3.91.960513074733.5451C-100000@pilot.njin.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 13 May 1996, David wrote:

> On Sun, 12 May 1996, Francisco Reyes wrote:
> 
> > I tried posting this question in the comp.unix.shell, but my post
> > failed so here it goes..
> > ----------------
> > At work there is one Linux computer and the bash shell there
> > has color prompts for different types of files. I have FreeBSD
> > at home and I would like to have colored prompts.
> > 
> > I have searched in the Bash FAQ and did not find anything
> > regarding colored prompts. I tried the man pages also.
> > 
> > Is this a feature available to Linux only?
> 
> 	I don't believe so.  I'm almost positive what you are referring 
> to is the color-ls package, which has been ported to FreeBSD already.  
> It's available as a package on ftp.freebsd.org. colorls-2.1.tgz is the 
> actual filename, which can be retrieved from /pub/FreeBSD/packages/All.
> 
> ..djw

	Take a look at the color_xterm port/package.  While both FreeBSD
and Linux do have different and distinct colorized "ls" packages, I
believe they both hinge upon having color_xterm installed.  The stock
xterm is monochrome, as are vt100 terminals.  At the console prompt you
can probably also get color into your prompts by using syscons/pcvt
specific escape codes or some such nonsense.  FYI, here's an example of
how to get "user@path" into both your prompt as well as your xterm title. 
Setting your colors should be analogous.  Note: the '^[' and '^G' are
control characters.  To enter literals in vi prfix them with ^v or in
emacs ^q. 

	MyPrompt=": \h@\w ;"
        PS1="^[]0;${MyPrompt}^G${MyPrompt}"

	Caveat: If you are using an unreliable link or terminal emulator 
which occasionally drops characters, your screen can get into a funny 
state when the right characters are dropped.  'stty sane' should clear up 
the problem.

cheers,

	Adrian

adrian@virginia.edu                ---->>>>| Support your local programmer,
System Administrator                 --->>>| STOP Software Patent Abuses NOW!
NVL, NIIMS and Telemedicine Labs       -->>| For an application and information
Member: League for Programming Freedom   ->| see: http://www.lpf.org/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.90.960513191924.5192A-100000>