bug-fileutils
[Top][All Lists]
Advanced

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

Re: PROBLEM: ls --color outputs undesirable leader and trailer


From: gregory mott
Subject: Re: PROBLEM: ls --color outputs undesirable leader and trailer
Date: 11 Jun 2003 22:05:10 +0100

On Tue, 2003-04-29 at 17:58, Bob Proulx wrote:
> On Tue, 2003-04-29 at 10:44, gregory mott wrote:
> > ls --version:    ls (fileutils) 4.1       (redhat7.3+up2date)
> > sort --version:  sort (textutils) 2.0.21  (redhat7.3+up2date)
> > 
> > problem:  ls --color's output is almost compatible with sort, but is
> > wanting of a minor modification.
> 
> Is 'ls --color' something you are doing or something Redhat is doing?
>
> I recommend that if you want color that you try using the auto option
> instead of always.  Try 'ls --color=auto' instead.  That turns off the
> escape sequences when the output is a pipe.  Not specifying auto is
> the same as saying --color=always.
> 
> Since 'ls' is already sorting the output I assume your sort example
> was just a simple way to illustrate a more general problem of handling
> the escape sequences, right?  Wondering if you are having trouble with
> 'locale' sorting because LANG is set.  But that would affect sort as
> well so probably not.

bob-

not sure what you mean exactly, i believe the --color feature is
implemented by gnu, not redhat, redhat's profile.d stuff likely has
aliases that invoke --color=auto, anwyay i have my own aliases that do
color=always.  i like still getting color when i pipe to less, or sort
and then less.  my whole point in writing you is that it works, and
would work well even for the less sophisticated who weren't ready to
implement a little filter hack like i did if the whole ls --color=always
output were no longer enclosed by those nonfunctional leading and
trailing color setting escape sequences.

the reason i invoke sort is to separate the directories from the files. 
come to think of it, now that i have your attention, how about that as
an option for ls?  i mean, i already do it for myself, so i don't care,
but it's the kind of thing that would be another modicum of improvement
for gnu/linux in general, heck it's just a popular (for me anyway)
feature that even msdos has had for years.

since you also mention locale i will also mention that i do have a
personal locale i made just for the purpose of sorting things the way i
want.  my locale sorts case intermixed.  i was floored that sorting case
intermixed just wasn't available until i cooked up a locale for myself,
but it was a nice little exercise.  and when i want case nonintermixed,
all i have to do is specify ls -v, which sorts everything the Right Way.

well now since i'm already rambling, i'll mention that my use of lesser
known ls -v was an unwitting lifesaver when a customer's machine was
hacked.  the hack replaced ls, but didn't implement ls -v, so it was my
first clue it was hacked!

anyway no matter what you do or don't do with any of this, thank you for
supporting gnu/fsf.

-greg





reply via email to

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