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?

link|improve this question

feedback

1 Answer

up vote 5 down vote accepted

From "Shell colors: colorizing shell scripts":

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.

link|improve this answer
Thanks for the update @slhck, it provided a more complete answer ;) – Linus Unnebäck Sep 5 '11 at 20:53
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.