bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls should not color output when --color=auto is used in environment


From: Bob Proulx
Subject: Re: ls should not color output when --color=auto is used in environment TERM=dumb
Date: Wed, 13 Jun 2007 01:56:58 -0600
User-agent: Mutt/1.5.9i

Lenny Domnitser wrote:
> Some terminals such as M-x shell in Emacs don't understand color
> output, and set the TERM environment variable to "dumb". ls should
> check that variable when turning on color from --color=auto.

The documented behavior of --color=auto is this:

        * auto - Only use color if standard output is a terminal.

This is designed so that an alias of ls='ls --color=auto' can be used
with pipes.  That is, "ls | grep foo" would expand because of the
alias to "ls --color=auto | grep foo" won't output color codes because
the output in that case will be a pipe and not a tty.

> For a use case of TERM=dumb which works around ls --color=auto, here's
> a snippet from /etc/skel/.bashrc in a Debian or Ubuntu system.
>
> # enable color support of ls and also add handy aliases
> if [ "$TERM" != "dumb" ]; then
>    eval "`dircolors -b`"
>    alias ls='ls --color=auto'
>    #alias dir='ls --color=auto --format=vertical'
>    #alias vdir='ls --color=auto --format=long'
> fi

I don't understand.  That snippet you show works perfectly for me.  I
am also an emacs user and the above configures perfectly for me within
an emacs shell.  Therefore I don't understand what problem you are
reporting.  Does the above not configure things for you properly?  Is
there a problem with it?

> If this bug is considered in scope for ls, I can probably code up a
> patch pretty soon.

Please clarify as to what the problem is that you are experiencing.  I
don't see a bug here yet.

Thanks
Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]