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=always
option to ls
set, either through an alias, functions or the LS_COLORS
environment variable and ls
is sending color directives to a non-terminal (that is, your pipe to less
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With