Make Your Bash Script Colorful With Echo Command

Sometimes it is necesary to get the attention of the user when executing a shell script. Whether it is an error that we would like to output to screen or just a plain message. Here’s where “echo” command comes in really handy. “Echo” supports different color formatting, and it takes the form of “e\[Nm…” where N is the number of the color and the “…” is the text you would like to output.
echo command colors
Here’s a list of text colors in bash
39 Default foreground color
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 Light gray
90 Dark gray
91 Light red
92 Light green
93 Light yellow
94 Light blue
95 Light magenta
96 Light cyan
97 White

Share This!

Leave a Reply

Your email address will not be published.