0

Possible Duplicate:
color text in terminal aplications in unix

I am working on a small Unix shell (written completely in C), and am wondering how to copy bash's prompt coloring technique. Are there libraries to do that? Has anyone ever tried them?

Community
  • 1
  • 1
rahmu
  • 5,588
  • 9
  • 35
  • 53

2 Answers2

2

You can use simple shell escape commands like \033[31mRed\033[0m or use the ncurses library.

Googling ncurses will give you all you need to get started.

Simon
  • 29,389
  • 8
  • 76
  • 90
1

The easiest way to do colorization in the unix shell is to use a library like curses / ncurses. It provides a portable way to implement items like corolization in the unix shell.

Here's a link to a nice tutorial on it

JaredPar
  • 703,665
  • 143
  • 1,211
  • 1,438