use name as GLOBSORT secondary sort key; new GLOBSORT sort specifier: `numeric'; let readonly and export work on local variables at previous scopes for both array and scalar variables

This commit is contained in:
Chet Ramey
2024-06-21 10:51:53 -04:00
parent 886e4e68be
commit ad1f497a84
29 changed files with 621 additions and 372 deletions
+27 -15
View File
@@ -1218,21 +1218,33 @@ PPAARRAAMMEETTEERRSS
value of this variable specifies the sort criteria and sort or-
der for the results of pathname expansion. If this variable is
unset or set to the null string, pathname expansion uses the
historical behavior of sorting by name. If set, a valid value
begins with an optional _+, which is ignored, or _-, which re-
verses the sort order from ascending to descending, followed by
a sort specifier. The valid sort specifiers are _n_a_m_e, _s_i_z_e,
_m_t_i_m_e, _a_t_i_m_e, _c_t_i_m_e, and _b_l_o_c_k_s, which sort the files on name,
file size, modification time, access time, inode change time,
and number of blocks, respectively. For example, a value of
_-_m_t_i_m_e sorts the results in descending order by modification
time (newest first). A sort specifier of _n_o_s_o_r_t disables sort-
ing completely; the results are returned in the order they are
read from the file system, and any leading _+ or _- is ignored.
If the sort specifier is missing, it defaults to _n_a_m_e, so a
value of _+ is equivalent to the null string, and a value of _-
sorts by name in descending order. Any invalid value restores
the historical sorting behavior.
historical behavior of sorting by name.
If set, a valid value begins with an optional _+, which is ig-
nored, or _-, which reverses the sort order from ascending to de-
scending, followed by a sort specifier. The valid sort speci-
fiers are _n_a_m_e, _n_u_m_e_r_i_c, _s_i_z_e, _m_t_i_m_e, _a_t_i_m_e, _c_t_i_m_e, and _b_l_o_c_k_s,
which sort the files on name, names in numeric rather than lexi-
cographic order, file size, modification time, access time, in-
ode change time, and number of blocks, respectively. If any of
the non-name keys compare as equal (e.g., if two files are the
same size), sorting uses the name as a secondary sort key. For
example, a value of _-_m_t_i_m_e sorts the results in descending order
by modification time (newest first).
The _n_u_m_e_r_i_c specifier treats names consisting solely of digits
as numbers and sorts them using the numeric value (so "2" will
sort before "10", for example). When using _n_u_m_e_r_i_c, names con-
taining non-digits sort after all the all-digit names and are
sorted by name using the traditional behavior.
A sort specifier of _n_o_s_o_r_t disables sorting completely; the re-
sults are returned in the order they are read from the file sys-
tem, and any leading _+ or _- is ignored. If the sort specifier
is missing, it defaults to _n_a_m_e, so a value of _+ is equivalent
to the null string, and a value of _- sorts by name in descending
order. Any invalid value restores the historical sorting behav-
ior.
HHIISSTTCCOONNTTRROOLL
A colon-separated list of values controlling how commands are
saved on the history list. If the list of values includes