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,708
  • 9
  • 39
  • 57

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
  • 31,675
  • 9
  • 80
  • 92
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
  • 733,204
  • 149
  • 1,241
  • 1,454