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