getting a terminal to STOP showing colors
byron at theclarkfamily.name
Tue Nov 11 15:39:21 MST 2008
On Tue, Nov 11, 2008 at 03:28:06PM -0700, Bryan Sant 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.
ls checks to see if stdout is a tty. If stdout isn't a tty then
it doesn't output any non-printable characters (including ANSI escape
sequences). ls also limits output to one item per line after detecting
that stdout is not a tty.
More information about the PLUG