I'm trying to add color output to my errors in bash on a Mac. The colors are not working:
#!/bin/bash
echo -e "\e[1;31m This is red text \e[0m"
I see no colors at all, as shown in this image. The color output of the ls
command is working fine however.
OSX ships with an old version of Bash that does not support the \e
escape character. Use \x1B
or update Bash (brew install bash
).
Even better, though, would be to use tput
.