1

I am on iTerm2 on mac, and my shell is Bash. I have the following settings. Bash does not recognize the colorcode and escapes.

$export CLICOLOR=1
$echo $TERM
xterm-256color
$echo -e "\e[31mHello World\e[0m"
\e[31mHello World\e[0m
$

Any suggestions on how do I fix this?

1

Try using \033 instead of \e:

echo -e "\033[31mHello World\033[0m"

Help from: http://tldp.org/LDP/abs/html/colorizing.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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