bug-coreutils
[Top][All Lists]
Advanced

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

Re: How to make the colors different for a symbol link pointing to a fil


From: Peng Yu
Subject: Re: How to make the colors different for a symbol link pointing to a file and symbol link pointing to a dir?
Date: Thu, 31 Dec 2009 09:35:22 -0600

On Thu, Dec 31, 2009 at 9:31 AM, Chris Jones <address@hidden> wrote:
> On Thu, Dec 31, 2009 at 07:28:05AM EST, Eric Blake wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> According to Chris Jones on 12/30/2009 11:26 PM:
>> > But pardon my ignorance, where exactly do you specify "LINK target"?
>>
>> In the source file that you feed to dircolors, so that dircolors can
>> generate the appropriate $LS_COLORS setting in your environment.  Some
>> distros provide ~/.dir_colors which will be automatically used as the file
>> fed to dircolors during something like /etc/login, the default ~/.bashrc,
>> or other startup file, although that starts to get into distro specifics.
>
> Ah, OK.. I had missed the dircolors command's -p switch.
>
> So I added the "LINK target" statement to my custom ~/.dircolors, and
> caused $LS_COLORS to be regenerated in a separate bash instance, and now
> I am getting this:
>
> ------------------------------------------------------------------------
> $ ls -alh -F --full-time --color=always
>
> drwxr-xr-x  7 user user 4.0K 2009-12-31  [..]  -0500 ./
> drwxrwxrwt 27 root root  12K 2009-12-31  [..]  -0500 ../
> drwxr-xr-x  2 user user 4.0K 2009-12-31  [..]  -0500 d1/
> -rw-r--r--  1 user user    0 2009-12-31  [..]  -0500 f1
> lrwxrwxrwx  1 user user    3 2009-12-31  [..]  -0500 argetmld1: -> d1:
> lrwxrwxrwx  1 user user    2 2009-12-31  [..]  -0500 lf1 -> f1
> ------------------------------------------------------------------------
>
> The 'ld1' soft link to directory 'd1' is prefixed by 'argetm'.
>
> Also both of the soft links are now white on black instead of the
> expected colors.
>
> Now where it gets really weird, is that I had recreated my test target
> directory /tmp/ldir, presumably after enabling 'LINK target' and when I
> revert to a shell where $LS_COLORS was gen'd without enabling 'LINK
> target', I have the following:
>
> ------------------------------------------------------------------------
> $ ls -alh -F --full-time --color=always
>
> drwxr-xr-x  7 user user 4.0K 2009-12-31  [..]  -0500 ./
> drwxrwxrwt 27 root root  12K 2009-12-31  [..]  -0500 ../
> drwxr-xr-x  2 user user 4.0K 2009-12-31  [..]  -0500 d1/
> -rw-r--r--  1 user user    0 2009-12-31  [..]  -0500 f1
> lrwxrwxrwx  1 user user    3 2009-12-31  [..]  -0500 ld1: -> d1:
> lrwxrwxrwx  1 user user    2 2009-12-31  [..]  -0500 lf1 -> f1
> ------------------------------------------------------------------------
>
> The 'ld1' soft link that I created is now listed as 'ld1:' with an
> appended colon (:) and it links to directory 'd1:' instead of 'd1'.
>
> Also, the '/' indicator is no longer appended to 'ld1 -> d1'.
>
> I proceeded to issue a 'file' command and this is the report:
>
> ------------------------------------------------------------------------
> d1:   directory
> f1:   empty
> ld1:: broken symbolic link to `d1:'
> lf1:  symbolic link to `f1'
> ------------------------------------------------------------------------
>
> .. which makes sense, since my test directory's file name is 'd1'.
>
> Other commands such as rm, etc. require that I use the ld1: name in
> order to recognized the soft link - 'rm ld1' comes back with 'No such
> file or directory' message as (not) expected.
>
> Not that this unduly bothers me but I'm curious and I thought I should
> report it.
>
> This is a debian 'lenny' system, with per 'dpkg -l' the following
> installed:
>
> bash          3.2-4                        The GNU Bourne Again SHell
> coreutils     6.10-6                       The GNU core utilities
>
> Attaching my ~/.dircolors custom file to this message just in case.
>
> Thank you for your comments.

BTW, I should have not only 'LINK target' but also other color
definitions in .dir_colors?




reply via email to

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