BASH Color Codes in Mac OS X 10.8

While trying to port my command line environment from Linux to Mac OS X I ran across a problem with the color codes in BASH not being recognized. The color codes I was using were in the form of

\e[0;30m

The problem was that the BASH shell under Mac OS X was not recognizing the escape sequence \e, the escape sequence you need to use under Mac OS X 10.8 is \033, so your color code would look like:

\033[0;30m

Which is actually the old way of writing the color codes. Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *