I am using Visual Studio Codium on MacOs.
When I open a terminal and enter echo "\033[31mThis is red font.\033[0m"
I get a nice red text.
When I run a shell script reading
#!/bin/bash
echo "\033[31mThis is red font.\033[0m"
in the same terminal I get \033[31mThis is red font.\033[0m
What can I do to have the shell scripts produce colored text in the terminal window?
CodePudding user response:
To cause escape sequences to interpreted, the -e
option can be used:
echo -e .....
As long as you use the bash-builtin echo
, this should be portable.