Jeff S. answered 05/11/21
Tutor
0
(0)
Software developer w/ 20+ years experience developing on Linux systems
echo -e "\033[31mYOUR TEXT\033[0m"
- The -e argument causes echo to interpret the back-slash character in a special way.
- When back-slash interpretation is enabled, "\033" is a representation for the 'escape' character.
- The terminal recognizes many special "escape sequences" that start with the escape character.
- The escape sequence "\033[31m" turns the text color to red.
- The escape sequence "\033[0m" at the end resets the color back to the default.
- A lot more information on these escape sequences can be found at https://en.wikipedia.org/wiki/ANSI_escape_code