--- Begin Message ---
Subject: |
Re: bug#19148: ls --inode --sort=inode |
Date: |
Fri, 21 Nov 2014 17:33:14 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 11/21/2014 04:57 PM, 積丹尼 Dan Jacobson wrote:
> $ man ls
> --sort=WORD
> sort by WORD instead of name: none (-U), size (-S), time (-t),
> version (-v), extension (-X)
>
> Perhaps add new functionality: inode (-i)
Nice idea, especially since we've already proven that 'rm' and other
tasks run faster when it first sorts by inode internally.
To _some_ extent, you can get the behavior by doing:
ls -iU | sort -k1,1n | sed 's/^[0-9]* //'
but since ls already is wired for sorting, it has a nice appeal to do it
all from with ls. Also, my workaround doesn't help with ls outputs
other than single file per line, and isn't entirely robust if a filename
contains newline.
However, we CANNOT treat '--sort=inode' as equivalent to '-i', because
the existing meaning of -i does NOT affect sorting (all of the other
sort options -U, -S, -t, -v, and -X DO affect sorting, and --sort is
just a long-option-y way of spelling the same), and for back-compat
reasons, we cannot change the behavior of -i. Also, I'm very reluctant
to burn another short-option letter for 'ls'. Besides, since both '-i'
and '-I' are already burned, and what other good mnemonic would we even
have?
I guess it would be okay to have a long option with no short-option
counterpart; it would look a bit awkward in the help text, but we could
figure something out.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
--- End Message ---