[TAG] Colouring $PS1...

Mahesh Aravind ra_mahesh at yahoo.com
Thu Jun 15 11:42:41 MSD 2006


Thomas,


--- Thomas Adam <thomas at edulinux.homeunix.org> wrote:

> 
> > o/p == out put
> 
> Ah, I see.  In the English language, "output" is all one word.
Here's some more that I'll be (or someone else'll be) using

w/o == without
h/w == hardware
s/w == software
s/o == Significant Other (*not* son of)
...

> 
> > How do you get the colour coordinates using tput?
> 
> Coordinates for what, or where?  All tput does is query the terminfo
> database.

Uh, ... fotget it!

> 
> > I was thinking of "private" use... in /etc/issue not /etc/issue.net?
> 
> That depends on your distribution.

Arrgh!  I don't seem to get my idea thru to you. See, when you feel like
creating an /etc/issue that'll emit your '\l' getty escape codes using
so-called  hard-coded escape colour codes like "^[[33;1m\l^[[0m", how can tput
come to the rescue?  Like you code up a shell script to o/p (err.. output,
sorry) a /tmp/issue that'll have correct escape codes querried form the
terminfo database.


> 
> > 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.)

Can tput escape codes be interpretted by getty?

> 
> > ("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.

Thomas (if I can call you by ur first name), my primary intention of writing
the  script was to find out the correct colour sequences to colour up the
various getty control codes (\l, \m, \n) etc., in /etc/issue and for ${PS1}.

So I can take in *any* suggestions to make it more useful (beware, I'm working
on v2.1 of the same) ...

useful, in the sense, anyone who feels like colouring their /etc/issue or
/etc/motd can look up this script and decide on what to do (and what not to do)


> 
> > 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).
> '''

Thanks, I might have missed it.


And one more thing, you don't mind me using this in my *private* /etc/issue,
right?  At least, decapitation is not an option for someone using hard coded
escape sequences!

Thanks for ur time...

Regards,

Mahesh Aravind


᾿ΕΝ ἀρχῂ ἦν τ? λάμβδα, κα? τ? λάμβδα ἦν πρ?ς τ?ν ῎Ημακα, κα? ῏Ημαξ
    ἦν τ? λάμβδα.
    (In the beginning was the lambda, and the lambda was with Emacs, and
    Emacs was the lambda.)

		       Hallelemacs!  Hallelemacs!
========================================================================
International					  Register yourself at:
GNU/Linux user #371671				  http://counter.li.org/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 





More information about the TAG mailing list