Color on echo output does not work

Hi,
When I run:

echo "\033[1;31mhi\033[m"

I see hi in color, but if I run this color is not shown, why?

(echo "\033[1;31mhi\033[m")|more

Thanks
Israel.

---------- Post updated at 05:17 AM ---------- Previous update was at 04:43 AM ----------

DONE!!

I had to run more -v.

Thanks

Remember the usage of Linux and/or ANSI color escape sequences is inherently unportable. You might want to investigate terminfo and tput to do this portably.

There are very few non-ANSI terminals left in this world. "Linux" escape sequences are mostly just ANSI ones. Where I still see huge disagreement between terminals is what key means which...

So.. what you're saying is that your solution isn't portable, but you BELIEVE that the world will eventually agree with your assumption about what a terminal is? Right? I stand by the advice I gave... it's worth your while (it's really not all that bad to learn how to do things right).

No. Usually, simple reading is an exercise left to the reader, but I'll help you along a little bit by breaking it into bullet points.

  • You're using "linux terminal" pejoratively. Linux terminals are ANSI. Sometimes with extensions, but the extensions are rarely used.
  • Color isn't one of these extensions, it's a basic ANSI feature. There's no special "Linux" color escape sequence which doesn't work in the rest of the world.
  • There are very few non-ANSI terminals left in the UNIX world. Portable is as portable does.

...we're not talking about an essential feature here, anyway. If someone wants to use this program over an ancient teletype, it's a trivial change.