[Top][All Lists]

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

Re: ls

From: Nino Pereira
Subject: Re: ls
Date: Wed, 05 Oct 2005 18:50:32 -0400

 While we (you) are still on 'ls', here's another question.

To check my understanding of what happens with scripts and such,
I commented out in .bashrc the command 'eval 'dircolors -b',
which I now understood to create the environment variable 
LS_COLORS suitable for the bash shell. 

I had expected that omitting this command would make coloration
disappear, but this is not the case. Why is that?


ps: this is the relevant part of my .bashrc.
   # enable color support of ls and also add handy aliases
# eval `dircolors -b`
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
    # if you want to pipe color, use e.g.,
    # alias ls --color=always | more

    # to get files with particular extensions in the color you want
    # the man pages suggest putting the information in a file
    # ~/.dir_colors
    # this file contains the color codes, e.g.,
    # 30=black 31=red 32=green 33=yellow 34=blue 35=magenta
    # 36=cyan 37=white, and more

    # this suggestion comes with a warning: 'not for Debian'.
    # A rather cryptic note in the man pages mentions that debian
    # has the color information 'in a pre-compiled data base'.
    # This database is compiled directly into dircolors,
    # not in an external binary file as I first thought.
    # since the --color option in ls takes its information from the
    # environment variable LS_COLORS, an alternative is to add what
    # you want directly to this environment, like so:
    # to check that this works, do $LS_COLORS in a terminal window.
export LS_COLORS
On Wed, 2005-10-05 at 15:03 -0700, Paul Eggert wrote:
> "Alfred M\. Szmidt" <address@hidden> writes:
> >    The command in question might be run anywhere (the documentation
> >    talks about "scripts").  That would include /tmp.
> >
> > `rm *' might also be run from anywhere, hence why don't get it.
> It's reasonable for a script to do 'eval "`dircolors`"', and this is
> in the manual.  Scripts might be run in any directory, including /tmp,
> so it's reasonable to recommend a safe way to invoke dircolors.
> On the other hand, scripts normally don't (and shouldn't) do 'rm *' in
> random directories, and we don't recommend that.

reply via email to

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