[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 5/8] builtins/source: parse the -i option
From: |
Chet Ramey |
Subject: |
Re: [PATCH v2 5/8] builtins/source: parse the -i option |
Date: |
Mon, 20 May 2024 11:44:13 -0400 |
User-agent: |
Mozilla Thunderbird |
On 5/17/24 1:15 PM, Robert Elz wrote:
| If `nosort' means no sorting, there is no imposed ordering, and ascending
| and descending are meaningless.
Sure, but directory order, and reverse directory order aren't (and that's
just a difference between the order in which you create the list as each
new dirent is read from the directory - does it go at the head or tail).
That's changing from one random order to another.
But in any case, it apparently isn't documented, if +nosort and -nosort
are to mean the same thing, then it should say so.
OK, that's easy enough.
| I'll consider it. What name would you propose for it?
Now that's the difficult question, I hate inventing names for
things - perhaps "number" or "numeric" or "numname" or ...
I like `numeric'.
All that matters is that it fall back to be "names" if the filenames are
not numeric (or at least if they don't start with digits, so atoi()
would just return 0), fully numeric names are the only ones that matter
to me.
Sure, but what do you prefer to do when you have results with a mix of
numeric values and string values? Pre-scan the results before sorting?
Let the comparison function handle it?
| Because it's a complication that may or may not be worth implementing
| without some critical mass of people asking for it. Let's see how this
| goes first.
The doc also doesn't indicate what happens when the sort method chosen
produces equal answers - that can't happen for names, since the same name
can't occur twice in the same directory, but for everything else that's
in the list it can. Does it then sort by name, by directory order, or
just by whatever order the sort algorithm (qsort?) happens to leave them
in when it is done?
Yes, it's unspecified.
Actually, one more option that might be worth adding (as a sort type)
might be "random" - giving different results every time the same pattern
is expanded.
I don't see this as worth the implementation cost.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, (continued)
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Robert Elz, 2024/05/16
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Lawrence Velázquez, 2024/05/16
- Stray comma in documentation of GLOBSORT, Lawrence Velázquez, 2024/05/17
- Re: Stray comma in documentation of GLOBSORT, Chet Ramey, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Robert Elz, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Greg Wooledge, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Robert Elz, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option,
Chet Ramey <=
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Martin D Kealey, 2024/05/21
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Robert Elz, 2024/05/17
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Andreas Kähäri, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Greg Wooledge, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Andreas Kähäri, 2024/05/20
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Phi Debian, 2024/05/21