Echo text in a certain color in a shell script

I am about to write a shell script. I would like to be able to visually distinguish some of its output text as a warning, by setting its color to yellow.

How is this done?


Solution 1:

From "ShellHacks: Bash Colors":

echo -e "\033[33mThis is yellow\033[0m"

or

echo -e "\e[33mThis is yellow\e[0m"

\033 or \e as an Escape character starts the escape sequence, which in this case contains the controls to change colors.