I got this in a file:
And when I do:
less -R demo
I get no colors:
What am I doing wrong?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You need to put the actual escape code in the file. One way to do this would be:
echo -e "\033[31mException log\033[0m" > file.txt
less -R file.txt should be able to interpret the color code.
These characters are not a colour code sequence, but they are the sequence to tell some tools/programming-languages to create the desired character sequence.
echo -e "\033[31mException log"