3

In bash, you can colorize output with (for example)

echo -e "\e[34mblue text\e[0m"

But that does not work with dash.

Is there a way to get colored output with dash?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Robby75
  • 3,285
  • 6
  • 33
  • 52

1 Answers1

6

With dash, bash, ksh, fish and zsh:

printf '%b' "\033[34;1mblue text\033[0m\n"
Cyrus
  • 84,225
  • 14
  • 89
  • 153
  • 1
    Or you could use `tput` and avoid the issue altogether: 'echo "$(tput setaf 4)blue text$(tput sgr0)"` or equivalent with `printf` – rici May 20 '16 at 18:14