If I execute ls command with pipe to less, I get strange output
ESC[00mESC[00mfile1.ccESC[00m
ESC[00file2.ccESC[00m
ESC[00file3.ccESC[00m
(means ESC string in between).
Without ls, the output is:
file1.cc file2.cc file3.cc
How to correct this?
I’m guessing that you have the
--color=alwaysoption tolsset, either through an alias, functions or theLS_COLORSenvironment variable andlsis sending color directives to a non-terminal (that is, your pipe toless).