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

Re: ls'ing dirs before files



martin f krafft wrote:
> also sprach Bob Proulx <bob@proulx.com> [2002.07.28.0348 +0200]:
> > Try setting LC_ALL=POSIX for a test and you will see the standard
> > behavior.  For a test you don't have to do it permanently, just for
> > that one command.
> > 
> >   LC_ALL=POSIX ls -a
> 
> Right, this now correctly separates dot-files and nondot-files, but
> directories and files are still interspersed. Same with setting
> LC_COLLATE to "C" (or LC_ALL).

Sorry but I was not answering your question but rather answering a
question by Nori Heikkinen <nori@sccs.swarthmore.edu> about why names
were sorting in dictionary name order.  A small drift from your
original question, but still on a related topic.

The test above shows how to make ls use standard sort order.  Don't
read more into it than that.

> > Those command just call strcoll(3) for the comparision.  So actually
> > the commands themselves have nothing to do with sort order
> > localization beyond that.  It all falls into the libc strcoll()
> > routine.  So in the end it is in the hands of libc.  Read this section
> > of the documentation on locales.
> 
> But these sorts happen on the name part of the inode, I would like
> these to first separate into dirs and files, then sort within...

I am guessing that when you were seeing this behavior previously that
you were using a different code base of ls, possibly forked from the
GNU sources.  I just did a web search and I turned up several patches
to unique patches from different people to ls for doing just that.

Bob

Attachment: pgprtv8k1KzsU.pgp
Description: PGP signature


Reply to: