getting a terminal to STOP showing colors

Joseph Hall joseph at thatworks.com
Tue Nov 11 15:54:09 MST 2008


On Tue, Nov 11, 2008 at 2:28 PM, Bryan Sant <bryan.sant at gmail.com> wrote:
> So I'm too lazy to look through the cat code, but I'm guessing that
> cat is explicitly striping ANSI codes (??).  Or is the shell (or
> something else) doing something magical?  You don't get any color/ANSI
> codes if you do "ls > foo" either.  I don't fully understand why.

It depends on the program, the shell that the program is run in, and
any options passed through. Try these three commands, from a regular
bash shell with $TERM set to xterm:

ls | less
ls --color=yes | less
ls --color=yes | less -r

Interesting, isn't it?

-- 
Joseph
http://blog.josephhall.com/



More information about the PLUG mailing list