[TAG] Colouring $PS1...

Thomas Adam thomas at edulinux.homeunix.org
Wed Jun 14 17:46:27 MSD 2006


On Wed, Jun 14, 2006 at 06:07:35AM -0700, Mahesh Aravind wrote:
> Wow...  looks like you're in a hot mood! (uh, read: angry)

Far from it.  Welcome to the ambiguity of email.

> o/p == out put

Ah, I see.  In the English language, "output" is all one word.

> How do you get the colour coordinates using tput?

Coordinates for what, or where?  All tput does is query the terminfo
database.

> I was thinking of "private" use... in /etc/issue not /etc/issue.net?

That depends on your distribution.

> like it'd be useful to have ^[[31;1m\n^[[0m to see your hostname in
> bright red or something...

Again, can be achieved via tput (you've been shown examples of this.)

> ("dazzling their retenas" -- is that a problem with my script?)

You seem to be under the impression that your script is somehow lacking
and isn't working.  That's not true.  Your script does work -- for some
terminals.  When you sent this script in to TAG, did think it was somehow
not open for discussion?  Constructive criticism such as the advice myself
and Ben have been giving you is there to aid you; and not to pick any
holes in your script.

> I think I misinterpreted what was in console_codes(4), can u correct
> me? I thought it said something like the Linux display driver handled
> the escape codes

No, it's the terminal that interprets them.  Note from console_codes(4):

``` 
It  is  generally not good practice to hard-wire terminal controls
into programs.  Linux supports a terminfo(5) database of terminal
capabili- ties.   Rather than emitting console escape sequences by hand,
you will almost always want to use a terminfo-aware screen  library  or
utility such as ncurses(3), tput(1), or reset(1).
'''

-- Thomas Adam

-- 
"If I were a witch's hat, sitting on her head like a paraffin stove, I'd
fly away and be a bat." -- Incredible String Band.





More information about the TAG mailing list