Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run a simple shell script with the following code:

printf "\e[32m Hello World\n"

I get

\e[32m Hello World

as output as opposed to a green Hello World output.

share|improve this question
I tried this command and it works just fine for me. – Wuffers Jun 21 '11 at 17:36
it doesnt work if i run it as part of a shell script – robin smith Jun 21 '11 at 17:37

printf doesn't understand \e; you need to use \033. Note that printf is also a bash builtin; that one has GNU extensions including \e, but unless you specifically request your script be run by /bin/bash you will usually get the POSIX one.

share|improve this answer

Your Answer


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.