delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/27/13:45:40

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How can I get colors from ls to less
Date: 27 Sep 2000 17:42:08 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 28
Message-ID: <8qtbhg$5mt$1@nets3.rz.RWTH-Aachen.DE>
References: <39D227C4 DOT 17D0A441 AT sensotech DOT at>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 970076528 5853 137.226.32.75 (27 Sep 2000 17:42:08 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 27 Sep 2000 17:42:08 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Wolfgang Polzleitner <wp AT sensotech DOT at> wrote:

> I wanted to use ls with the color option, i.e.,
> and pipe the resulting output into less, i.e.,
>  ls --color=yes -l | less

> The first part gives me nice colored output as expected, but 'less' does
> not display colors anymore. Instead it displays the escape characters
> like ESC[00m_bashrcESC[00m.

The key reason for this is that 'less' doesn't generally trust arbitrary
files to be displayable without causing some mayhem to the terminal
(making it unusable until reboot, or whatever) --- it's its Unix legacy
shining through, here.

That's why it will display Escape sequance literally, rather than just
executing them. You can switch that off by typing

-r<Return>

while less is running.

If that still doesn't work, that would mean 'less' doesn't have the
terminal escape sequence treatment built into it that 'ls' and 'bash'
have --- I don't have one here to check it.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019