[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?
Nino
ps: this is the relevant part of my .bashrc.
(snip)
# 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:
LS_COLORS='*.eps=01;31':$LS_COLORS
LS_COLORS='*.tex=01;31':$LS_COLORS
# to check that this works, do $LS_COLORS in a terminal window.
export LS_COLORS
(snip)
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.
>
- Re: ls, Alfred M\. Szmidt, 2005/10/02
- Re: ls, Eric Blake, 2005/10/03
- Re: ls, Alfred M\. Szmidt, 2005/10/03
- Re: ls, Eric Blake, 2005/10/03
- Re: ls, Alfred M\. Szmidt, 2005/10/03
- Re: ls, Paul Eggert, 2005/10/04
- Re: ls, Alfred M\. Szmidt, 2005/10/05
- Re: ls, Eric Blake, 2005/10/05
- Re: ls, Alfred M\. Szmidt, 2005/10/05
- Re: ls, Paul Eggert, 2005/10/05
- Re: ls,
Nino Pereira <=
- Re: ls, Alfred M\. Szmidt, 2005/10/05
- Re: ls, Nino Pereira, 2005/10/05
Re: ls, Eric Blake, 2005/10/05
- Re: ls, Alfred M\. Szmidt, 2005/10/05
Re: ls, Eric Blake, 2005/10/05
- Re: ls, Nino Pereira, 2005/10/06
Re: ls, Eric Blake, 2005/10/06
- Re: ls, Nino Pereira, 2005/10/09
- Re: ls, Eric Blake, 2005/10/10