color code

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 :wink:

  • Mario

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 > :wink:

  • Mario

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 > :wink:

  • Mario

ā€œ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}

:wink:

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 > :wink:

  • Mario