FAQ Database Discussion Community


ANSI escapes don't work in `printf`

bash,printf,sh,ansi-colors
When trying to use ANSI color escapes from a shell script, I was completely stuck, as the escape sequences (\e) were printed verbatim to the output. #!/bin/sh GREEN="\e[32m" RED="\e[31m" CLEAR="\e[0m" printf "${GREEN}test passed${CLEAR}\n" printf "${RED}test failed${CLEAR}\n" Produces \e[32mtest passed\e[0m \e[31mtest failed\e[0m ...

Highlighting Vim text with black background when ANSI colors are off

osx,vim,ansi-colors
I'm on OSX. I've turned ANSI colors off in Terminal.app. This is great, but now visual selections are no longer highlighted. I'd like them to be simply inverted with a black background and white text. I know this is possible in a colorless terminal, because the status line is still...

ANSI what does this sequence mean?

go,ansi-colors
I know that this is ANSI color sequence, but what does this mean? BLUE = "\x1b[38;05;4m" \x1b is escape (ASCII 27) What is 38? What is 05? and What is 4m? It seems there are no such thing on the list?...