Dot files always first in directory?

Frank Wales frank at zen.co.uk
Thu May 11 18:33:18 AEST 1989


In article <167 at dg.dg.com> rec at dg.UUCP (Robert Cousins) writes:
>In article <2892 at osiris.UUCP> consult at osiris.UUCP (Unix Consultation Mailbox (Phil)) writes:
>>That ain't no horse, it's a red herring.
>>
>>The order of files in a "directory listing" (using ls, which by default
>>sorts everything by ASCII collating sequence before writing it to stdout)
>>has nothing to do with the real order of the files in the directory.  
>
>Actually, when one types in "ls *", the shell places all of the filenames
>which match the "*" on the command line as a replacement.  It is the SHELL
>which sorts them in alphabetical order.

That's a herring of another colour.  Try:

	ls `ls|sort -r`

How the shell expands metacharacters is irrelevant to what ls does
with its arg list once it gets it, options excepted.
--
Frank Wales, Systems Manager,        [frank at zen.co.uk<->mcvax!zen.co.uk!frank]
Zengrange Ltd., Greenfield Rd., Leeds, ENGLAND, LS9 8DB. (+44) 532 489048 x217 



More information about the Comp.unix.wizards mailing list