Mailing List Archive

dircolors issue
Perhaps a dummy question:
I noticed that on my Slackware box the output of dircolors looks like:

LS_COLORS=3D'no=3D00:fi=3D00:di=3D01;34:ln=3D01;36:pi=3D40;33:so=3D01;35
:=
bd=3D40;33;01:c
d=3D40;33;01:or=3D40;31;01:ex=3D01;32:*.cmd=3D01;32:*.exe=3D01;32:*.com=
3D=
01;32:*.bt
m=3D01;32:*.bat=3D01;32:*.tar=3D01;31:*.tgz=3D01;31:*.arj=3D01;31:*.taz=
3D=
01;31:*.lz
h=3D01;31:*.zip=3D01;31:*.bz2=3D01;31:*.rpm=3D01;31:*.deb=3D01;31:*.z=3D
0=
1;31:*.Z=3D01
;31:*.gz=3D01;31:*.jpg=3D01;35:*.gif=3D01;35:*.bmp=3D01;35:*.ppm=3D01;35
:=
*.tga=3D01;
35:*.xbm=3D01;35:*.xpm=3D01;35:*.tif=3D01;35:*.mpg=3D01;37:*.avi=3D01;37
:=
*.mov=3D01;
37:'
export LS_COLORS
LS_OPTIONS=3D' --color=3Dauto -F -b -T 0'
export LS_OPTIONS
alias ls=3D'/bin/ls $LS_OPTIONS';
alias dir=3D'/bin/ls $LS_OPTIONS --format=3Dvertical';
alias vdir=3D'/bin/ls $LS_OPTIONS --format=3Dlong';
alias d=3Ddir;
alias v=3Dvdir;

But on my Gentoo 2004.2 its only

LS_COLORS=3D'no=3D00:fi=3D00:di=3D01;34:ln=3D01;36:pi=3D40;33:so=3D01;35
:=
do=3D01;35:bd=3D4
0;33;01:cd=3D40;33;01:or=3D40;31;01:ex=3D01;32:*.tar=3D01;31:*.tgz=3D01;
3=
1:*.arj=3D0
1;31:*.taz=3D01;31:*.lzh=3D01;31:*.zip=3D01;31:*.z=3D01;31:*.Z=3D01;31:*
.=
gz=3D01;31:
*.bz2=3D01;31:*.deb=3D01;31:*.rpm=3D01;31:*.jar=3D01;31:*.jpg=3D01;35:*.
j=
peg=3D01;35
:*.gif=3D01;35:*.bmp=3D01;35:*.pbm=3D01;35:*.pgm=3D01;35:*.ppm=3D01;35:*
.=
tga=3D01;35
:*.xbm=3D01;35:*.xpm=3D01;35:*.tif=3D01;35:*.tiff=3D01;35:*.png=3D01;35:
*=
.mov=3D01;3
5:*.mpg=3D01;35:*.mpeg=3D01;35:*.avi=3D01;35:*.fli=3D01;35:*.gl=3D01;35:
*=
.dl=3D01;35
:*.xcf=3D01;35:*.xwd=3D01;35:*.ogg=3D01;35:*.mp3=3D01;35:*.wav=3D01;35:'
export LS_COLORS

The version on both is the same (fileutils 4.0). The real downer is
that I've updated my /etc/profile on the Gentoo box to make the same
statements as what the Slackware box says but it doesn't show me the
output of ls in color!? If, however, I login then run the commands it
will show the output in color. Isn't /etc/profile read each time bash
is invoked? Shouldn't it load my dircolrs? Do I need to add those
aliases? Seems odd, man ls says that if LS_OPTIONS is set that it will
use it by default, but seems not to.

/djb


--
gentoo-user@gentoo.org mailing list
Re: dircolors issue [ In reply to ]
At 2004-10-28T15:33:35-0700, David Busby <busby@edoceo.com> wrote:
> Perhaps a dummy question:
> I noticed that on my Slackware box the output of dircolors looks like:
<snip>
> But on my Gentoo 2004.2 its only
<snip>
> The version on both is the same (fileutils 4.0). The real downer is
> that I've updated my /etc/profile on the Gentoo box to make the same
> statements as what the Slackware box says but it doesn't show me the
> output of ls in color!? If, however, I login then run the commands it
> will show the output in color. Isn't /etc/profile read each time bash
> is invoked? Shouldn't it load my dircolrs? Do I need to add those
> aliases? Seems odd, man ls says that if LS_OPTIONS is set that it will
> use it by default, but seems not to.

Slackware patches ls & dircolors to do spiffier stuff than the rest of
us. Among other fanciness, Slackware adds those aliases you see in the
output of dircolors(1) and, presumably, that LS_OPTIONS variable you
mention. With any other distro, you will have to add those aliases
yourself.

I have something like the following in my .bashrc:

bashrc> eval $(dircolors -b /etc/DIR_COLORS)
bashrc> sl() { ls --color ${@+"$@"} ; }

You may find dir_colors(5) helpful. Be sure to read the manpages on your
Gentoo system, though. My version of ls(1) doesn't mention anything
about LS_OPTIONS.

--
Batou: Hey, Major... You ever hear of "human rights"?
Kusanagi: I understand the concept, but I've never seen it in action.
--Ghost in the Shell
Re: dircolors issue [ In reply to ]
At 2004-10-28T15:33:35-0700, David Busby <busby@edoceo.com> wrote:
> The version on both is the same (fileutils 4.0). The real downer is
> that I've updated my /etc/profile on the Gentoo box to make the same
> statements as what the Slackware box says but it doesn't show me the
> output of ls in color!? If, however, I login then run the commands it
> will show the output in color.

> Isn't /etc/profile read each time bash is invoked?
> Shouldn't it load my dircolrs?

No ;-)
Please, look at the bash man page, section "INVOCATION" (or info bash -> "Bash
Features" -> "Bash Startup Files").
Briefly:
-- when you login: /etc/profile -> ~/.bash_profile
-- when you open an xterm window: ~/.bashrc

The info page says: " So, typically, your `~/.bash_profile' contains the line
`if [ -f ~/.bashrc ]; then . ~/.bashrc; fi' "

So you should put something like

eval `dircolors -b /etc/DIR_COLORS`
alias l='ls -lF --color'
alias ll='ls -alF --color'

into your ~/.bashrc

and

[ -f ~/.bashrc ] && . ~/.bashrc

into your ~/.bash_profile.

> Do I need to add those aliases? Seems odd, man ls says that
> if LS_OPTIONS is set that it will use it by default, but seems not to.

You need LS_COLORS, which is set by dircolors -b /etc/DIR_COLORS.

HTH

Sergio

--
gentoo-user@gentoo.org mailing list