Azitech

Azimout's Linux weblog

colored ouput from bash script

leave a comment »

To output text from a bash script, you do echo _text_. If you want to control the color of the output, you do echo -e ‘\E[color1;color2mYour Text.’ (color1 is the foreground, color2 the background color).

For example, for green characters you do echo -e ‘\E[32mtext’, while for red characters you do echo -e ‘\E[31mtext’.

Reference here. Examples here.

Advertisements

Written by azimout

18/08/2008 at 09:28

Posted in Reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: