DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Shell Scripting (http://www.daniweb.com/forums/forum113.html)
-   -   Colored output in bash? (http://www.daniweb.com/forums/thread33099.html)

mmiikkee12 Sep 28th, 2005 6:33 pm
Colored output in bash?
 
Anyone know how to put colored text on the screen in a bash script?

mawe Sep 29th, 2005 1:52 am
Re: Colored output in bash?
 
Hi!

Use escape sequences: echo -e '\E[color1;color2mYour Text.'
(color1 is the foreground, color2 the background color)
 echo -e '\E[30m black \E[31mred \E[32mgreen \E[33myellow \E[34mblue \E[35mmagenta \E[36mcyan \E[37mwhite'
 echo -e '\E[30;41mblack on red'
Color:           Foreground:           Background:
---------------------------------------------------------
black            30                      40
red              31                      41
green            32                      42
yellow            33                      43
blue              34                      44
magenta          35                      45
cyan              36                      46
white            37                      47
Regards, mawe


All times are GMT -4. The time now is 12:00 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC