Zen-Dreams

Zen-Dreams.com

Shell script, how-to make them look better

  • Français

When you program a shell script, it’s always usefull to have some message reporting immediatly such as OK or Error. So here is a little how-to get color in your shell scripts.

In order to do so, you just have to use ASCII characters within your command-line. This will make them more eye appealing.

The syntax is the following :

echo -e \033[X;Ym_TEXT_\033[m

with X:
0-> normal color
1-> bright color
3-> dark color
4-> underlined text
7-> highlighted text
9-> strike through text

With Y being the code for the color :
30 = Grey
31 = Red
32 = Green
33 = Yellow
34 = Blue
35 = Purple
36 = Cyan

By Anthony

Post a Comment

Your email is never shared. Required fields are marked *

*
*