Most (if not all) cases where a *nix command prints colored output without the user specifically asking for it with an option involve aliases. In fact, many Linux distributions include an alias for ls
and grep
specifying colors in the global /etc/bash.bashrc
.
These are from my Linux Mint Debian Edition:
$ grep alias /etc/bash.bashrc alias ls='ls --color=auto' alias grep='grep --colour=auto'
So, if your program is calling these commands through BASH, you are running ls --color=auto
instead of ls
.
You can bypass aliases in BASH (maybe other shells too but I have not tried it) by the following methods (taken from here):
the full pathname of the command:
/bin/ls
command substitution:
$(which ls)
the command builtin:
command ls
double quotation marks:
"ls"
single quotation marks:
'ls'
a backslash character:
\ls
If you use one of these methods in your software you should not have to worry about escape sequences.