color code

bridged with qdn.public.qnxrtp.applications
Post Reply
Mario Charest

color code

Post by Mario Charest » Thu Apr 11, 2002 4:50 pm

I would like to display text in color/bold etc from the shell (echo command
for example).
Is there a standard and simply way to do this. I would like to avoid having
to change
this for every terminal type ;-)

- Mario

Richard Kramer

Re: color code

Post by Richard Kramer » Thu Apr 11, 2002 6:57 pm

There's tput, but it's not 100% for all terminals. For example, on some
terminals, "bold" is the same as normal; on others, "dim" is the same as
normal. Try "man tput" or look in the back of the ncurses manual.

On Qnx4, termtype - qnx or qansi, this works:
echo "hello \c;tput bold;echo mario;tput sgr0

As the man page illustrates, you (or your script) can get sexier by
doing something like bd=`tput bold`;nm=`tput sgr0

Mario Charest wrote:
I would like to display text in color/bold etc from the shell (echo command
for example).
Is there a standard and simply way to do this. I would like to avoid having
to change
this for every terminal type ;-)

- Mario

Richard Kramer

Re: color code

Post by Richard Kramer » Thu Apr 11, 2002 7:03 pm

Something happened - here is the completed version.

Richard Kramer wrote:
There's tput, but it's not 100% for all terminals. For example, on some
terminals, "bold" is the same as normal; on others, "dim" is the same as
normal. Try "man tput" or look in the back of the ncurses manual.

On Qnx4, termtype - qnx or qansi, this works:
echo "hello \c;tput bold;echo mario;tput sgr0

As the man page illustrates, you (or your script) can get sexier by
doing something like bd=`tput bold`;nm=`tput sgr0
doing something like:
bd=`tput bold`;nm=`tput sgr0`;echo hello ${bd}mario${nm}

Richard

Mario Charest wrote:

I would like to display text in color/bold etc from the shell (echo command
for example).
Is there a standard and simply way to do this. I would like to avoid having
to change
this for every terminal type ;-)

- Mario

Mario Charest

Re: color code

Post by Mario Charest » Thu Apr 11, 2002 8:01 pm

"Richard Kramer" <rrkramer@kramer-smilko.com> wrote in message
news:3CB5DDFC.D83A94CF@kramer-smilko.com...
Something happened - here is the completed version.

Richard Kramer wrote:

There's tput, but it's not 100% for all terminals. For example, on some
terminals, "bold" is the same as normal; on others, "dim" is the same as
normal. Try "man tput" or look in the back of the ncurses manual.

On Qnx4, termtype - qnx or qansi, this works:
echo "hello \c;tput bold;echo mario;tput sgr0

As the man page illustrates, you (or your script) can get sexier by
doing something like bd=`tput bold`;nm=`tput sgr0
doing something like:
bd=`tput bold`;nm=`tput sgr0`;echo hello ${bd}mario${nm}
;-)

Cool, couldn't find tput on QNX6 but I grabbed it from the web (termutils)
and it compile out of the box, thanks.
Richard



Mario Charest wrote:

I would like to display text in color/bold etc from the shell (echo
command
for example).
Is there a standard and simply way to do this. I would like to avoid
having
to change
this for every terminal type ;-)

- Mario

Post Reply

Return to “qdn.public.qnxrtp.applications”