Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 6 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.

share|improve this answer
    
Thanks for the update @slhck, it provided a more complete answer ;) –  Linus Unnebäck Sep 5 '11 at 20:53
    
The link leads to a page which is quite unusable (blocked by adds...) –  Mike Aski Jun 16 '13 at 6:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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