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
+31
View File
@@ -9646,3 +9646,34 @@ builtins/source.def
doc/bash.1,doc/bashref.texi
- source: document -p
pathexp.c
- if the size, blocks, or any of the time values compare equal, use
the name for a secondary sort key
lib/sh/winsize.c
- tcgetwinsize: provide definition for missing newly-standard function
- get_new_window_size: use tcgetwinsize
subst.c
- do_compound_assignment: if ASS_CHKLOCAL is in the flags, check for
variables at previous local scopes instead of just the current local
scope and the global scope
Part of fix for inconsistency between arrays and scalar variables
reported by Will Allan <billyzkid@yahoo.com>
builtins/declare.def
- declare_find_variable: if `declare -G' is used, check for
variables at previous local scopes instead of just the current local
scope and the global scope
Rest of fix for inconsistency between arrays and scalar variables
reported by Will Allan <billyzkid@yahoo.com>
pathexp.h
- SORT_NUMERIC: new "numeric" sort specifier
pathexp.c
- globsort_numericcmp: new sort function for the "numeric" sort
specifier: all-digit names are sorted as numbers; names containing
any non-digits sort after all-digit names and are sorted
lexicographically.
Inspired by a discussion with Robert Elz <kre@munnari.oz.au>
+1
View File
@@ -1639,6 +1639,7 @@ tests/varenv21.sub f
tests/varenv22.sub f
tests/varenv23.sub f
tests/varenv24.sub f
tests/varenv25.sub f
tests/version f
tests/version.mini f
tests/vredir.tests f
+3 -8
View File
@@ -152,13 +152,8 @@ declare_find_variable (const char *name, int mkglobal, int chklocal)
if (mkglobal == 0)
return (find_variable (name));
else if (chklocal)
{
var = find_variable (name);
if (var && local_p (var) && var->context == variable_context)
return var;
/* XXX - add check for previous scopes here if wanted 6/4/2024 */
return (find_global_variable (name));
}
/* Changed to find variables at previous local scopes 6/12/2024 */
return (find_variable (name));
else
return (find_global_variable (name));
}
@@ -315,7 +310,7 @@ declare_internal (WORD_LIST *list, int local_var)
case 'f':
*flags |= att_function;
break;
case 'G':
case 'G': /* undocumented, used internally */
if (flags == &flags_on)
chklocal = 1;
/*FALLTHROUGH*/
+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
+15 -1
View File
@@ -2305,26 +2305,39 @@ of the patterns in
it is removed from the list of matches.
.TP
.B GLOBSORT
.PD
Control how the results of pathname expansion are sorted.
The value of this variable specifies the sort criteria and sort order 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.
.IP
If set, a valid value begins with an optional \fI+\fP, which is ignored,
or \fI\-\fP, which reverses the sort order from ascending to descending,
followed by a sort specifier.
The valid sort specifiers are
.IR name ,
.IR numeric ,
.IR size ,
.IR mtime ,
.IR atime ,
.IR ctime ,
and
.IR blocks ,
which sort the files on name, file size, modification time, access time,
which sort the files on name, names in numeric rather than lexicographic order,
file size, modification time, access time,
inode 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 \fI\-mtime\fP sorts the results in descending
order by modification time (newest first).
.IP
The \fInumeric\fP 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 \fInumeric\fP, names containing non-digits sort after all
the all-digit names and are sorted by name using the traditional behavior.
.IP
A sort specifier of \fInosort\fP disables sorting completely; the results
are returned in the order they are read from the file system,
and any leading \fI+\fP or \fI\-\fP is ignored.
@@ -2332,6 +2345,7 @@ If the sort specifier is missing, it defaults to \fIname\fP,
so a value of \fI+\fP is equivalent to the null string,
and a value of \fI-\fP sorts by name in descending order.
Any invalid value restores the historical sorting behavior.
.PD 0
.TP
.B HISTCONTROL
A colon-separated list of values controlling how commands are saved on
+138 -129
View File
@@ -5723,14 +5723,23 @@ Variables::).
behavior of sorting by name. If set, a valid value begins with an
optional +, which is ignored, or -, which reverses the sort
order from ascending to descending, followed by a sort specifier.
The valid sort specifiers are name, size, mtime, atime,
ctime, and blocks, which sort the files on name, file size,
modification time, access time, inode change time, and number of
blocks, respectively.
The valid sort specifiers are name, numeric, size, mtime,
atime, ctime, and blocks, which sort the files on name, names
in numeric rather than lexicographic order, file size, modification
time, access time, inode 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 -mtime sorts the results in descending
order by modification time (newest first).
The numeric 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 numeric, names containing
non-digits sort after all the all-digit names and are sorted by
name using the traditional behavior.
A sort specifier of nosort disables sorting completely; the
results are returned in the order they are read from the file
system, and any leading - is ignored.
@@ -12480,57 +12489,57 @@ D.3 Parameter and Variable Index
* FUNCNEST: Bash Variables. (line 361)
* GLOBIGNORE: Bash Variables. (line 366)
* GLOBSORT: Bash Variables. (line 373)
* GROUPS: Bash Variables. (line 399)
* histchars: Bash Variables. (line 405)
* HISTCMD: Bash Variables. (line 420)
* HISTCONTROL: Bash Variables. (line 426)
* HISTFILE: Bash Variables. (line 442)
* HISTFILESIZE: Bash Variables. (line 447)
* HISTIGNORE: Bash Variables. (line 458)
* GROUPS: Bash Variables. (line 408)
* histchars: Bash Variables. (line 414)
* HISTCMD: Bash Variables. (line 429)
* HISTCONTROL: Bash Variables. (line 435)
* HISTFILE: Bash Variables. (line 451)
* HISTFILESIZE: Bash Variables. (line 456)
* HISTIGNORE: Bash Variables. (line 467)
* history-preserve-point: Readline Init File Syntax.
(line 214)
* history-size: Readline Init File Syntax.
(line 220)
* HISTSIZE: Bash Variables. (line 480)
* HISTTIMEFORMAT: Bash Variables. (line 487)
* HISTSIZE: Bash Variables. (line 489)
* HISTTIMEFORMAT: Bash Variables. (line 496)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 229)
* HOSTFILE: Bash Variables. (line 496)
* HOSTNAME: Bash Variables. (line 507)
* HOSTTYPE: Bash Variables. (line 510)
* HOSTFILE: Bash Variables. (line 505)
* HOSTNAME: Bash Variables. (line 516)
* HOSTTYPE: Bash Variables. (line 519)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 513)
* IGNOREEOF: Bash Variables. (line 522)
* input-meta: Readline Init File Syntax.
(line 238)
* INPUTRC: Bash Variables. (line 523)
* INSIDE_EMACS: Bash Variables. (line 527)
* INPUTRC: Bash Variables. (line 532)
* INSIDE_EMACS: Bash Variables. (line 536)
* isearch-terminators: Readline Init File Syntax.
(line 248)
* keymap: Readline Init File Syntax.
(line 255)
* LANG: Creating Internationalized Scripts.
(line 51)
* LANG <1>: Bash Variables. (line 533)
* LC_ALL: Bash Variables. (line 537)
* LC_COLLATE: Bash Variables. (line 541)
* LC_CTYPE: Bash Variables. (line 548)
* LANG <1>: Bash Variables. (line 542)
* LC_ALL: Bash Variables. (line 546)
* LC_COLLATE: Bash Variables. (line 550)
* LC_CTYPE: Bash Variables. (line 557)
* LC_MESSAGES: Creating Internationalized Scripts.
(line 51)
* LC_MESSAGES <1>: Bash Variables. (line 553)
* LC_NUMERIC: Bash Variables. (line 557)
* LC_TIME: Bash Variables. (line 561)
* LINENO: Bash Variables. (line 565)
* LINES: Bash Variables. (line 570)
* MACHTYPE: Bash Variables. (line 576)
* LC_MESSAGES <1>: Bash Variables. (line 562)
* LC_NUMERIC: Bash Variables. (line 566)
* LC_TIME: Bash Variables. (line 570)
* LINENO: Bash Variables. (line 574)
* LINES: Bash Variables. (line 579)
* MACHTYPE: Bash Variables. (line 585)
* MAIL: Bourne Shell Variables.
(line 22)
* MAILCHECK: Bash Variables. (line 580)
* MAILCHECK: Bash Variables. (line 589)
* MAILPATH: Bourne Shell Variables.
(line 27)
* MAPFILE: Bash Variables. (line 588)
* MAPFILE: Bash Variables. (line 597)
* mark-modified-lines: Readline Init File Syntax.
(line 285)
* mark-symlinked-directories: Readline Init File Syntax.
@@ -12541,46 +12550,46 @@ D.3 Parameter and Variable Index
(line 302)
* meta-flag: Readline Init File Syntax.
(line 238)
* OLDPWD: Bash Variables. (line 592)
* OLDPWD: Bash Variables. (line 601)
* OPTARG: Bourne Shell Variables.
(line 34)
* OPTERR: Bash Variables. (line 595)
* OPTERR: Bash Variables. (line 604)
* OPTIND: Bourne Shell Variables.
(line 38)
* OSTYPE: Bash Variables. (line 599)
* OSTYPE: Bash Variables. (line 608)
* output-meta: Readline Init File Syntax.
(line 307)
* page-completions: Readline Init File Syntax.
(line 315)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 602)
* POSIXLY_CORRECT: Bash Variables. (line 608)
* PPID: Bash Variables. (line 618)
* PROMPT_COMMAND: Bash Variables. (line 622)
* PROMPT_DIRTRIM: Bash Variables. (line 628)
* PS0: Bash Variables. (line 634)
* PIPESTATUS: Bash Variables. (line 611)
* POSIXLY_CORRECT: Bash Variables. (line 617)
* PPID: Bash Variables. (line 627)
* PROMPT_COMMAND: Bash Variables. (line 631)
* PROMPT_DIRTRIM: Bash Variables. (line 637)
* PS0: Bash Variables. (line 643)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
* PS3: Bash Variables. (line 639)
* PS4: Bash Variables. (line 644)
* PWD: Bash Variables. (line 652)
* RANDOM: Bash Variables. (line 655)
* READLINE_ARGUMENT: Bash Variables. (line 661)
* READLINE_LINE: Bash Variables. (line 665)
* READLINE_MARK: Bash Variables. (line 669)
* READLINE_POINT: Bash Variables. (line 675)
* REPLY: Bash Variables. (line 679)
* PS3: Bash Variables. (line 648)
* PS4: Bash Variables. (line 653)
* PWD: Bash Variables. (line 661)
* RANDOM: Bash Variables. (line 664)
* READLINE_ARGUMENT: Bash Variables. (line 670)
* READLINE_LINE: Bash Variables. (line 674)
* READLINE_MARK: Bash Variables. (line 678)
* READLINE_POINT: Bash Variables. (line 684)
* REPLY: Bash Variables. (line 688)
* revert-all-at-newline: Readline Init File Syntax.
(line 325)
* search-ignore-case: Readline Init File Syntax.
(line 332)
* SECONDS: Bash Variables. (line 682)
* SHELL: Bash Variables. (line 691)
* SHELLOPTS: Bash Variables. (line 696)
* SHLVL: Bash Variables. (line 705)
* SECONDS: Bash Variables. (line 691)
* SHELL: Bash Variables. (line 700)
* SHELLOPTS: Bash Variables. (line 705)
* SHLVL: Bash Variables. (line 714)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 337)
* show-all-if-unmodified: Readline Init File Syntax.
@@ -12589,15 +12598,15 @@ D.3 Parameter and Variable Index
(line 352)
* skip-completed-text: Readline Init File Syntax.
(line 358)
* SRANDOM: Bash Variables. (line 710)
* SRANDOM: Bash Variables. (line 719)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
* TEXTDOMAINDIR: Creating Internationalized Scripts.
(line 51)
* TIMEFORMAT: Bash Variables. (line 719)
* TMOUT: Bash Variables. (line 757)
* TMPDIR: Bash Variables. (line 769)
* UID: Bash Variables. (line 773)
* TIMEFORMAT: Bash Variables. (line 728)
* TMOUT: Bash Variables. (line 766)
* TMPDIR: Bash Variables. (line 778)
* UID: Bash Variables. (line 782)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 371)
* vi-ins-mode-string: Readline Init File Syntax.
@@ -13050,77 +13059,77 @@ Node: Special Builtins234437
Node: Shell Variables235426
Node: Bourne Shell Variables235860
Node: Bash Variables238053
Node: Bash Features274670
Node: Invoking Bash275684
Node: Bash Startup Files282083
Node: Interactive Shells287395
Node: What is an Interactive Shell?287803
Node: Is this Shell Interactive?288469
Node: Interactive Shell Behavior289293
Node: Bash Conditional Expressions293047
Node: Shell Arithmetic298221
Node: Aliases301303
Node: Arrays304258
Node: The Directory Stack311057
Node: Directory Stack Builtins311854
Node: Controlling the Prompt316303
Node: The Restricted Shell319441
Node: Bash POSIX Mode322228
Node: Shell Compatibility Mode339739
Node: Job Control348758
Node: Job Control Basics349215
Node: Job Control Builtins354389
Node: Job Control Variables360349
Node: Command Line Editing361526
Node: Introduction and Notation363230
Node: Readline Interaction364874
Node: Readline Bare Essentials366062
Node: Readline Movement Commands367880
Node: Readline Killing Commands368877
Node: Readline Arguments370855
Node: Searching371912
Node: Readline Init File374141
Node: Readline Init File Syntax375423
Node: Conditional Init Constructs400361
Node: Sample Init File404726
Node: Bindable Readline Commands407847
Node: Commands For Moving409072
Node: Commands For History411299
Node: Commands For Text416504
Node: Commands For Killing420638
Node: Numeric Arguments423439
Node: Commands For Completion424591
Node: Keyboard Macros428907
Node: Miscellaneous Commands429608
Node: Readline vi Mode436262
Node: Programmable Completion437214
Node: Programmable Completion Builtins445171
Node: A Programmable Completion Example456737
Node: Using History Interactively462082
Node: Bash History Facilities462763
Node: Bash History Builtins465875
Node: History Interaction471118
Node: Event Designators475443
Node: Word Designators477026
Node: Modifiers479012
Node: Installing Bash480921
Node: Basic Installation482055
Node: Compilers and Options485934
Node: Compiling For Multiple Architectures486684
Node: Installation Names488433
Node: Specifying the System Type490667
Node: Sharing Defaults491413
Node: Operation Controls492127
Node: Optional Features493146
Node: Reporting Bugs504948
Node: Major Differences From The Bourne Shell506297
Node: GNU Free Documentation License526032
Node: Indexes551209
Node: Builtin Index551660
Node: Reserved Word Index558758
Node: Variable Index561203
Node: Function Index578334
Node: Concept Index592190
Node: Bash Features275218
Node: Invoking Bash276232
Node: Bash Startup Files282631
Node: Interactive Shells287943
Node: What is an Interactive Shell?288351
Node: Is this Shell Interactive?289017
Node: Interactive Shell Behavior289841
Node: Bash Conditional Expressions293595
Node: Shell Arithmetic298769
Node: Aliases301851
Node: Arrays304806
Node: The Directory Stack311605
Node: Directory Stack Builtins312402
Node: Controlling the Prompt316851
Node: The Restricted Shell319989
Node: Bash POSIX Mode322776
Node: Shell Compatibility Mode340287
Node: Job Control349306
Node: Job Control Basics349763
Node: Job Control Builtins354937
Node: Job Control Variables360897
Node: Command Line Editing362074
Node: Introduction and Notation363778
Node: Readline Interaction365422
Node: Readline Bare Essentials366610
Node: Readline Movement Commands368428
Node: Readline Killing Commands369425
Node: Readline Arguments371403
Node: Searching372460
Node: Readline Init File374689
Node: Readline Init File Syntax375971
Node: Conditional Init Constructs400909
Node: Sample Init File405274
Node: Bindable Readline Commands408395
Node: Commands For Moving409620
Node: Commands For History411847
Node: Commands For Text417052
Node: Commands For Killing421186
Node: Numeric Arguments423987
Node: Commands For Completion425139
Node: Keyboard Macros429455
Node: Miscellaneous Commands430156
Node: Readline vi Mode436810
Node: Programmable Completion437762
Node: Programmable Completion Builtins445719
Node: A Programmable Completion Example457285
Node: Using History Interactively462630
Node: Bash History Facilities463311
Node: Bash History Builtins466423
Node: History Interaction471666
Node: Event Designators475991
Node: Word Designators477574
Node: Modifiers479560
Node: Installing Bash481469
Node: Basic Installation482603
Node: Compilers and Options486482
Node: Compiling For Multiple Architectures487232
Node: Installation Names488981
Node: Specifying the System Type491215
Node: Sharing Defaults491961
Node: Operation Controls492675
Node: Optional Features493694
Node: Reporting Bugs505496
Node: Major Differences From The Bourne Shell506845
Node: GNU Free Documentation License526580
Node: Indexes551757
Node: Builtin Index552208
Node: Reserved Word Index559306
Node: Variable Index561751
Node: Function Index578882
Node: Concept Index592738

End Tag Table
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -162,7 +162,7 @@
@xrdef{The Set Builtin-pg}{69}
@xrdef{The Shopt Builtin-title}{The Shopt Builtin}
@xrdef{The Shopt Builtin-snt}{Section@tie 4.3.2}
@xrdef{The Shopt Builtin-pg}{73}
@xrdef{The Shopt Builtin-pg}{74}
@xrdef{Special Builtins-title}{Special Builtins}
@xrdef{Special Builtins-snt}{Section@tie 4.4}
@xrdef{Special Builtins-pg}{80}
@@ -291,21 +291,21 @@
@xrdef{Commands For Killing-pg}{143}
@xrdef{Numeric Arguments-title}{Specifying Numeric Arguments}
@xrdef{Numeric Arguments-snt}{Section@tie 8.4.5}
@xrdef{Numeric Arguments-pg}{144}
@xrdef{Commands For Completion-title}{Letting Readline Type For You}
@xrdef{Commands For Completion-snt}{Section@tie 8.4.6}
@xrdef{Numeric Arguments-pg}{145}
@xrdef{Commands For Completion-pg}{145}
@xrdef{Keyboard Macros-title}{Keyboard Macros}
@xrdef{Keyboard Macros-snt}{Section@tie 8.4.7}
@xrdef{Keyboard Macros-pg}{146}
@xrdef{Miscellaneous Commands-title}{Some Miscellaneous Commands}
@xrdef{Miscellaneous Commands-snt}{Section@tie 8.4.8}
@xrdef{Keyboard Macros-pg}{147}
@xrdef{Miscellaneous Commands-pg}{147}
@xrdef{Readline vi Mode-title}{Readline vi Mode}
@xrdef{Readline vi Mode-snt}{Section@tie 8.5}
@xrdef{Readline vi Mode-pg}{149}
@xrdef{Programmable Completion-title}{Programmable Completion}
@xrdef{Programmable Completion-snt}{Section@tie 8.6}
@xrdef{Readline vi Mode-pg}{149}
@xrdef{Programmable Completion-pg}{150}
@xrdef{Programmable Completion Builtins-title}{Programmable Completion Builtins}
@xrdef{Programmable Completion Builtins-snt}{Section@tie 8.7}
+4 -4
View File
@@ -3,14 +3,14 @@
\entry{break}{50}{\code {break}}
\entry{cd}{50}{\code {cd}}
\entry{continue}{50}{\code {continue}}
\entry{eval}{50}{\code {eval}}
\entry{eval}{51}{\code {eval}}
\entry{exec}{51}{\code {exec}}
\entry{exit}{51}{\code {exit}}
\entry{export}{51}{\code {export}}
\entry{false}{51}{\code {false}}
\entry{getopts}{51}{\code {getopts}}
\entry{hash}{52}{\code {hash}}
\entry{pwd}{52}{\code {pwd}}
\entry{pwd}{53}{\code {pwd}}
\entry{readonly}{53}{\code {readonly}}
\entry{return}{53}{\code {return}}
\entry{shift}{53}{\code {shift}}
@@ -39,11 +39,11 @@
\entry{readarray}{67}{\code {readarray}}
\entry{source}{67}{\code {source}}
\entry{type}{67}{\code {type}}
\entry{typeset}{67}{\code {typeset}}
\entry{typeset}{68}{\code {typeset}}
\entry{ulimit}{68}{\code {ulimit}}
\entry{unalias}{69}{\code {unalias}}
\entry{set}{69}{\code {set}}
\entry{shopt}{73}{\code {shopt}}
\entry{shopt}{74}{\code {shopt}}
\entry{dirs}{106}{\code {dirs}}
\entry{popd}{106}{\code {popd}}
\entry{pushd}{106}{\code {pushd}}
+4 -4
View File
@@ -26,7 +26,7 @@
\initial {E}
\entry{\code {echo}}{61}
\entry{\code {enable}}{62}
\entry{\code {eval}}{50}
\entry{\code {eval}}{51}
\entry{\code {exec}}{51}
\entry{\code {exit}}{51}
\entry{\code {export}}{51}
@@ -54,7 +54,7 @@
\entry{\code {popd}}{106}
\entry{\code {printf}}{64}
\entry{\code {pushd}}{106}
\entry{\code {pwd}}{52}
\entry{\code {pwd}}{53}
\initial {R}
\entry{\code {read}}{65}
\entry{\code {readarray}}{67}
@@ -63,7 +63,7 @@
\initial {S}
\entry{\code {set}}{69}
\entry{\code {shift}}{53}
\entry{\code {shopt}}{73}
\entry{\code {shopt}}{74}
\entry{\code {source}}{67}
\entry{\code {suspend}}{121}
\initial {T}
@@ -72,7 +72,7 @@
\entry{\code {trap}}{55}
\entry{\code {true}}{56}
\entry{\code {type}}{67}
\entry{\code {typeset}}{67}
\entry{\code {typeset}}{68}
\initial {U}
\entry{\code {ulimit}}{68}
\entry{\code {umask}}{56}
+13 -13
View File
@@ -20,13 +20,13 @@
\entry{forward-search-history (C-s)}{140}{\code {forward-search-history (C-s)}}
\entry{non-incremental-reverse-search-history (M-p)}{140}{\code {non-incremental-reverse-search-history (M-p)}}
\entry{non-incremental-forward-search-history (M-n)}{141}{\code {non-incremental-forward-search-history (M-n)}}
\entry{history-search-forward ()}{141}{\code {history-search-forward ()}}
\entry{history-search-backward ()}{141}{\code {history-search-backward ()}}
\entry{history-substring-search-forward ()}{141}{\code {history-substring-search-forward ()}}
\entry{history-search-forward ()}{141}{\code {history-search-forward ()}}
\entry{history-substring-search-backward ()}{141}{\code {history-substring-search-backward ()}}
\entry{history-substring-search-forward ()}{141}{\code {history-substring-search-forward ()}}
\entry{yank-nth-arg (M-C-y)}{141}{\code {yank-nth-arg (M-C-y)}}
\entry{yank-last-arg (M-. or M-_)}{141}{\code {yank-last-arg (M-. or M-_)}}
\entry{operate-and-get-next (C-o)}{141}{\code {operate-and-get-next (C-o)}}
\entry{operate-and-get-next (C-o)}{142}{\code {operate-and-get-next (C-o)}}
\entry{fetch-history ()}{142}{\code {fetch-history ()}}
\entry{end-of-file (usually C-d)}{142}{\code {\i {end-of-file} (usually C-d)}}
\entry{delete-char (C-d)}{142}{\code {delete-char (C-d)}}
@@ -45,7 +45,7 @@
\entry{kill-line (C-k)}{143}{\code {kill-line (C-k)}}
\entry{backward-kill-line (C-x Rubout)}{143}{\code {backward-kill-line (C-x Rubout)}}
\entry{unix-line-discard (C-u)}{143}{\code {unix-line-discard (C-u)}}
\entry{kill-whole-line ()}{143}{\code {kill-whole-line ()}}
\entry{kill-whole-line ()}{144}{\code {kill-whole-line ()}}
\entry{kill-word (M-d)}{144}{\code {kill-word (M-d)}}
\entry{backward-kill-word (M-DEL)}{144}{\code {backward-kill-word (M-\key {DEL})}}
\entry{shell-kill-word (M-C-d)}{144}{\code {shell-kill-word (M-C-d)}}
@@ -59,15 +59,15 @@
\entry{copy-forward-word ()}{144}{\code {copy-forward-word ()}}
\entry{yank (C-y)}{144}{\code {yank (C-y)}}
\entry{yank-pop (M-y)}{144}{\code {yank-pop (M-y)}}
\entry{digit-argument (M-0, M-1, ...{} M--)}{144}{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}}
\entry{digit-argument (M-0, M-1, ...{} M--)}{145}{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}}
\entry{universal-argument ()}{145}{\code {universal-argument ()}}
\entry{complete (TAB)}{145}{\code {complete (\key {TAB})}}
\entry{possible-completions (M-?)}{145}{\code {possible-completions (M-?)}}
\entry{insert-completions (M-*)}{145}{\code {insert-completions (M-*)}}
\entry{menu-complete ()}{145}{\code {menu-complete ()}}
\entry{menu-complete-backward ()}{145}{\code {menu-complete-backward ()}}
\entry{delete-char-or-list ()}{145}{\code {delete-char-or-list ()}}
\entry{complete-filename (M-/)}{145}{\code {complete-filename (M-/)}}
\entry{delete-char-or-list ()}{146}{\code {delete-char-or-list ()}}
\entry{complete-filename (M-/)}{146}{\code {complete-filename (M-/)}}
\entry{possible-filename-completions (C-x /)}{146}{\code {possible-filename-completions (C-x /)}}
\entry{complete-username (M-~)}{146}{\code {complete-username (M-~)}}
\entry{possible-username-completions (C-x ~)}{146}{\code {possible-username-completions (C-x ~)}}
@@ -80,8 +80,8 @@
\entry{dynamic-complete-history (M-TAB)}{146}{\code {dynamic-complete-history (M-\key {TAB})}}
\entry{dabbrev-expand ()}{146}{\code {dabbrev-expand ()}}
\entry{complete-into-braces (M-{\indexlbrace })}{146}{\code {complete-into-braces (M-{\tt \char 123})}}
\entry{start-kbd-macro (C-x ()}{146}{\code {start-kbd-macro (C-x ()}}
\entry{end-kbd-macro (C-x ))}{146}{\code {end-kbd-macro (C-x ))}}
\entry{start-kbd-macro (C-x ()}{147}{\code {start-kbd-macro (C-x ()}}
\entry{end-kbd-macro (C-x ))}{147}{\code {end-kbd-macro (C-x ))}}
\entry{call-last-kbd-macro (C-x e)}{147}{\code {call-last-kbd-macro (C-x e)}}
\entry{print-last-kbd-macro ()}{147}{\code {print-last-kbd-macro ()}}
\entry{re-read-init-file (C-x C-r)}{147}{\code {re-read-init-file (C-x C-r)}}
@@ -94,16 +94,16 @@
\entry{set-mark (C-@)}{147}{\code {set-mark (C-@)}}
\entry{exchange-point-and-mark (C-x C-x)}{147}{\code {exchange-point-and-mark (C-x C-x)}}
\entry{character-search (C-])}{147}{\code {character-search (C-])}}
\entry{character-search-backward (M-C-])}{147}{\code {character-search-backward (M-C-])}}
\entry{skip-csi-sequence ()}{147}{\code {skip-csi-sequence ()}}
\entry{character-search-backward (M-C-])}{148}{\code {character-search-backward (M-C-])}}
\entry{skip-csi-sequence ()}{148}{\code {skip-csi-sequence ()}}
\entry{insert-comment (M-#)}{148}{\code {insert-comment (M-#)}}
\entry{dump-functions ()}{148}{\code {dump-functions ()}}
\entry{dump-variables ()}{148}{\code {dump-variables ()}}
\entry{dump-macros ()}{148}{\code {dump-macros ()}}
\entry{spell-correct-word (C-x s)}{148}{\code {spell-correct-word (C-x s)}}
\entry{glob-complete-word (M-g)}{148}{\code {glob-complete-word (M-g)}}
\entry{glob-expand-word (C-x *)}{148}{\code {glob-expand-word (C-x *)}}
\entry{glob-list-expansions (C-x g)}{148}{\code {glob-list-expansions (C-x g)}}
\entry{glob-expand-word (C-x *)}{149}{\code {glob-expand-word (C-x *)}}
\entry{glob-list-expansions (C-x g)}{149}{\code {glob-list-expansions (C-x g)}}
\entry{display-shell-version (C-x C-v)}{149}{\code {display-shell-version (C-x C-v)}}
\entry{shell-expand-line (M-C-e)}{149}{\code {shell-expand-line (M-C-e)}}
\entry{history-expand-line (M-^)}{149}{\code {history-expand-line (M-^)}}
+11 -11
View File
@@ -15,12 +15,12 @@
\entry{\code {call-last-kbd-macro (C-x e)}}{147}
\entry{\code {capitalize-word (M-c)}}{143}
\entry{\code {character-search (C-])}}{147}
\entry{\code {character-search-backward (M-C-])}}{147}
\entry{\code {character-search-backward (M-C-])}}{148}
\entry{\code {clear-display (M-C-l)}}{140}
\entry{\code {clear-screen (C-l)}}{140}
\entry{\code {complete (\key {TAB})}}{145}
\entry{\code {complete-command (M-!)}}{146}
\entry{\code {complete-filename (M-/)}}{145}
\entry{\code {complete-filename (M-/)}}{146}
\entry{\code {complete-hostname (M-@)}}{146}
\entry{\code {complete-into-braces (M-{\tt \char 123})}}{146}
\entry{\code {complete-username (M-~)}}{146}
@@ -31,9 +31,9 @@
\initial {D}
\entry{\code {dabbrev-expand ()}}{146}
\entry{\code {delete-char (C-d)}}{142}
\entry{\code {delete-char-or-list ()}}{145}
\entry{\code {delete-char-or-list ()}}{146}
\entry{\code {delete-horizontal-space ()}}{144}
\entry{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}}{144}
\entry{\code {digit-argument (\kbd {M-0}, \kbd {M-1}, \dots {} \kbd {M--})}}{145}
\entry{\code {display-shell-version (C-x C-v)}}{149}
\entry{\code {do-lowercase-version (M-A, M-B, M-\var {x}, \dots {})}}{147}
\entry{\code {downcase-word (M-l)}}{143}
@@ -43,7 +43,7 @@
\entry{\code {dynamic-complete-history (M-\key {TAB})}}{146}
\initial {E}
\entry{\code {edit-and-execute-command (C-x C-e)}}{149}
\entry{\code {end-kbd-macro (C-x ))}}{146}
\entry{\code {end-kbd-macro (C-x ))}}{147}
\entry{\code {\i {end-of-file} (usually C-d)}}{142}
\entry{\code {end-of-history (M->)}}{140}
\entry{\code {end-of-line (C-e)}}{139}
@@ -57,8 +57,8 @@
\entry{\code {forward-word (M-f)}}{139}
\initial {G}
\entry{\code {glob-complete-word (M-g)}}{148}
\entry{\code {glob-expand-word (C-x *)}}{148}
\entry{\code {glob-list-expansions (C-x g)}}{148}
\entry{\code {glob-expand-word (C-x *)}}{149}
\entry{\code {glob-list-expansions (C-x g)}}{149}
\initial {H}
\entry{\code {history-and-alias-expand-line ()}}{149}
\entry{\code {history-expand-line (M-^)}}{149}
@@ -73,7 +73,7 @@
\initial {K}
\entry{\code {kill-line (C-k)}}{143}
\entry{\code {kill-region ()}}{144}
\entry{\code {kill-whole-line ()}}{143}
\entry{\code {kill-whole-line ()}}{144}
\entry{\code {kill-word (M-d)}}{144}
\initial {M}
\entry{\code {magic-space ()}}{149}
@@ -85,7 +85,7 @@
\entry{\code {non-incremental-forward-search-history (M-n)}}{141}
\entry{\code {non-incremental-reverse-search-history (M-p)}}{140}
\initial {O}
\entry{\code {operate-and-get-next (C-o)}}{141}
\entry{\code {operate-and-get-next (C-o)}}{142}
\entry{\code {overwrite-mode ()}}{143}
\initial {P}
\entry{\code {possible-command-completions (C-x !)}}{146}
@@ -114,9 +114,9 @@
\entry{\code {shell-forward-word (M-C-f)}}{139}
\entry{\code {shell-kill-word (M-C-d)}}{144}
\entry{\code {shell-transpose-words (M-C-t)}}{143}
\entry{\code {skip-csi-sequence ()}}{147}
\entry{\code {skip-csi-sequence ()}}{148}
\entry{\code {spell-correct-word (C-x s)}}{148}
\entry{\code {start-kbd-macro (C-x ()}}{146}
\entry{\code {start-kbd-macro (C-x ()}}{147}
\initial {T}
\entry{\code {tilde-expand (M-&)}}{147}
\entry{\code {transpose-chars (C-t)}}{142}
+138 -129
View File
@@ -5724,14 +5724,23 @@ Variables::).
behavior of sorting by name. If set, a valid value begins with an
optional +, which is ignored, or -, which reverses the sort
order from ascending to descending, followed by a sort specifier.
The valid sort specifiers are name, size, mtime, atime,
ctime, and blocks, which sort the files on name, file size,
modification time, access time, inode change time, and number of
blocks, respectively.
The valid sort specifiers are name, numeric, size, mtime,
atime, ctime, and blocks, which sort the files on name, names
in numeric rather than lexicographic order, file size, modification
time, access time, inode 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 -mtime sorts the results in descending
order by modification time (newest first).
The numeric 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 numeric, names containing
non-digits sort after all the all-digit names and are sorted by
name using the traditional behavior.
A sort specifier of nosort disables sorting completely; the
results are returned in the order they are read from the file
system, and any leading - is ignored.
@@ -12481,57 +12490,57 @@ D.3 Parameter and Variable Index
* FUNCNEST: Bash Variables. (line 361)
* GLOBIGNORE: Bash Variables. (line 366)
* GLOBSORT: Bash Variables. (line 373)
* GROUPS: Bash Variables. (line 399)
* histchars: Bash Variables. (line 405)
* HISTCMD: Bash Variables. (line 420)
* HISTCONTROL: Bash Variables. (line 426)
* HISTFILE: Bash Variables. (line 442)
* HISTFILESIZE: Bash Variables. (line 447)
* HISTIGNORE: Bash Variables. (line 458)
* GROUPS: Bash Variables. (line 408)
* histchars: Bash Variables. (line 414)
* HISTCMD: Bash Variables. (line 429)
* HISTCONTROL: Bash Variables. (line 435)
* HISTFILE: Bash Variables. (line 451)
* HISTFILESIZE: Bash Variables. (line 456)
* HISTIGNORE: Bash Variables. (line 467)
* history-preserve-point: Readline Init File Syntax.
(line 214)
* history-size: Readline Init File Syntax.
(line 220)
* HISTSIZE: Bash Variables. (line 480)
* HISTTIMEFORMAT: Bash Variables. (line 487)
* HISTSIZE: Bash Variables. (line 489)
* HISTTIMEFORMAT: Bash Variables. (line 496)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 229)
* HOSTFILE: Bash Variables. (line 496)
* HOSTNAME: Bash Variables. (line 507)
* HOSTTYPE: Bash Variables. (line 510)
* HOSTFILE: Bash Variables. (line 505)
* HOSTNAME: Bash Variables. (line 516)
* HOSTTYPE: Bash Variables. (line 519)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 513)
* IGNOREEOF: Bash Variables. (line 522)
* input-meta: Readline Init File Syntax.
(line 238)
* INPUTRC: Bash Variables. (line 523)
* INSIDE_EMACS: Bash Variables. (line 527)
* INPUTRC: Bash Variables. (line 532)
* INSIDE_EMACS: Bash Variables. (line 536)
* isearch-terminators: Readline Init File Syntax.
(line 248)
* keymap: Readline Init File Syntax.
(line 255)
* LANG: Creating Internationalized Scripts.
(line 51)
* LANG <1>: Bash Variables. (line 533)
* LC_ALL: Bash Variables. (line 537)
* LC_COLLATE: Bash Variables. (line 541)
* LC_CTYPE: Bash Variables. (line 548)
* LANG <1>: Bash Variables. (line 542)
* LC_ALL: Bash Variables. (line 546)
* LC_COLLATE: Bash Variables. (line 550)
* LC_CTYPE: Bash Variables. (line 557)
* LC_MESSAGES: Creating Internationalized Scripts.
(line 51)
* LC_MESSAGES <1>: Bash Variables. (line 553)
* LC_NUMERIC: Bash Variables. (line 557)
* LC_TIME: Bash Variables. (line 561)
* LINENO: Bash Variables. (line 565)
* LINES: Bash Variables. (line 570)
* MACHTYPE: Bash Variables. (line 576)
* LC_MESSAGES <1>: Bash Variables. (line 562)
* LC_NUMERIC: Bash Variables. (line 566)
* LC_TIME: Bash Variables. (line 570)
* LINENO: Bash Variables. (line 574)
* LINES: Bash Variables. (line 579)
* MACHTYPE: Bash Variables. (line 585)
* MAIL: Bourne Shell Variables.
(line 22)
* MAILCHECK: Bash Variables. (line 580)
* MAILCHECK: Bash Variables. (line 589)
* MAILPATH: Bourne Shell Variables.
(line 27)
* MAPFILE: Bash Variables. (line 588)
* MAPFILE: Bash Variables. (line 597)
* mark-modified-lines: Readline Init File Syntax.
(line 285)
* mark-symlinked-directories: Readline Init File Syntax.
@@ -12542,46 +12551,46 @@ D.3 Parameter and Variable Index
(line 302)
* meta-flag: Readline Init File Syntax.
(line 238)
* OLDPWD: Bash Variables. (line 592)
* OLDPWD: Bash Variables. (line 601)
* OPTARG: Bourne Shell Variables.
(line 34)
* OPTERR: Bash Variables. (line 595)
* OPTERR: Bash Variables. (line 604)
* OPTIND: Bourne Shell Variables.
(line 38)
* OSTYPE: Bash Variables. (line 599)
* OSTYPE: Bash Variables. (line 608)
* output-meta: Readline Init File Syntax.
(line 307)
* page-completions: Readline Init File Syntax.
(line 315)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 602)
* POSIXLY_CORRECT: Bash Variables. (line 608)
* PPID: Bash Variables. (line 618)
* PROMPT_COMMAND: Bash Variables. (line 622)
* PROMPT_DIRTRIM: Bash Variables. (line 628)
* PS0: Bash Variables. (line 634)
* PIPESTATUS: Bash Variables. (line 611)
* POSIXLY_CORRECT: Bash Variables. (line 617)
* PPID: Bash Variables. (line 627)
* PROMPT_COMMAND: Bash Variables. (line 631)
* PROMPT_DIRTRIM: Bash Variables. (line 637)
* PS0: Bash Variables. (line 643)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
* PS3: Bash Variables. (line 639)
* PS4: Bash Variables. (line 644)
* PWD: Bash Variables. (line 652)
* RANDOM: Bash Variables. (line 655)
* READLINE_ARGUMENT: Bash Variables. (line 661)
* READLINE_LINE: Bash Variables. (line 665)
* READLINE_MARK: Bash Variables. (line 669)
* READLINE_POINT: Bash Variables. (line 675)
* REPLY: Bash Variables. (line 679)
* PS3: Bash Variables. (line 648)
* PS4: Bash Variables. (line 653)
* PWD: Bash Variables. (line 661)
* RANDOM: Bash Variables. (line 664)
* READLINE_ARGUMENT: Bash Variables. (line 670)
* READLINE_LINE: Bash Variables. (line 674)
* READLINE_MARK: Bash Variables. (line 678)
* READLINE_POINT: Bash Variables. (line 684)
* REPLY: Bash Variables. (line 688)
* revert-all-at-newline: Readline Init File Syntax.
(line 325)
* search-ignore-case: Readline Init File Syntax.
(line 332)
* SECONDS: Bash Variables. (line 682)
* SHELL: Bash Variables. (line 691)
* SHELLOPTS: Bash Variables. (line 696)
* SHLVL: Bash Variables. (line 705)
* SECONDS: Bash Variables. (line 691)
* SHELL: Bash Variables. (line 700)
* SHELLOPTS: Bash Variables. (line 705)
* SHLVL: Bash Variables. (line 714)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 337)
* show-all-if-unmodified: Readline Init File Syntax.
@@ -12590,15 +12599,15 @@ D.3 Parameter and Variable Index
(line 352)
* skip-completed-text: Readline Init File Syntax.
(line 358)
* SRANDOM: Bash Variables. (line 710)
* SRANDOM: Bash Variables. (line 719)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
* TEXTDOMAINDIR: Creating Internationalized Scripts.
(line 51)
* TIMEFORMAT: Bash Variables. (line 719)
* TMOUT: Bash Variables. (line 757)
* TMPDIR: Bash Variables. (line 769)
* UID: Bash Variables. (line 773)
* TIMEFORMAT: Bash Variables. (line 728)
* TMOUT: Bash Variables. (line 766)
* TMPDIR: Bash Variables. (line 778)
* UID: Bash Variables. (line 782)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 371)
* vi-ins-mode-string: Readline Init File Syntax.
@@ -13051,77 +13060,77 @@ Node: Special Builtins234611
Node: Shell Variables235603
Node: Bourne Shell Variables236040
Node: Bash Variables238236
Node: Bash Features274856
Node: Invoking Bash275873
Node: Bash Startup Files282275
Node: Interactive Shells287590
Node: What is an Interactive Shell?288001
Node: Is this Shell Interactive?288670
Node: Interactive Shell Behavior289497
Node: Bash Conditional Expressions293254
Node: Shell Arithmetic298431
Node: Aliases301516
Node: Arrays304474
Node: The Directory Stack311276
Node: Directory Stack Builtins312076
Node: Controlling the Prompt316528
Node: The Restricted Shell319669
Node: Bash POSIX Mode322459
Node: Shell Compatibility Mode339973
Node: Job Control348995
Node: Job Control Basics349455
Node: Job Control Builtins354632
Node: Job Control Variables360595
Node: Command Line Editing361775
Node: Introduction and Notation363482
Node: Readline Interaction365129
Node: Readline Bare Essentials366320
Node: Readline Movement Commands368141
Node: Readline Killing Commands369141
Node: Readline Arguments371122
Node: Searching372182
Node: Readline Init File374414
Node: Readline Init File Syntax375699
Node: Conditional Init Constructs400640
Node: Sample Init File405008
Node: Bindable Readline Commands408132
Node: Commands For Moving409360
Node: Commands For History411590
Node: Commands For Text416798
Node: Commands For Killing420935
Node: Numeric Arguments423739
Node: Commands For Completion424894
Node: Keyboard Macros429213
Node: Miscellaneous Commands429917
Node: Readline vi Mode436574
Node: Programmable Completion437529
Node: Programmable Completion Builtins445489
Node: A Programmable Completion Example457058
Node: Using History Interactively462406
Node: Bash History Facilities463090
Node: Bash History Builtins466205
Node: History Interaction471451
Node: Event Designators475779
Node: Word Designators477365
Node: Modifiers479354
Node: Installing Bash481266
Node: Basic Installation482403
Node: Compilers and Options486285
Node: Compiling For Multiple Architectures487038
Node: Installation Names488790
Node: Specifying the System Type491027
Node: Sharing Defaults491776
Node: Operation Controls492493
Node: Optional Features493515
Node: Reporting Bugs505320
Node: Major Differences From The Bourne Shell506672
Node: GNU Free Documentation License526410
Node: Indexes551590
Node: Builtin Index552044
Node: Reserved Word Index559145
Node: Variable Index561593
Node: Function Index578727
Node: Concept Index592586
Node: Bash Features275404
Node: Invoking Bash276421
Node: Bash Startup Files282823
Node: Interactive Shells288138
Node: What is an Interactive Shell?288549
Node: Is this Shell Interactive?289218
Node: Interactive Shell Behavior290045
Node: Bash Conditional Expressions293802
Node: Shell Arithmetic298979
Node: Aliases302064
Node: Arrays305022
Node: The Directory Stack311824
Node: Directory Stack Builtins312624
Node: Controlling the Prompt317076
Node: The Restricted Shell320217
Node: Bash POSIX Mode323007
Node: Shell Compatibility Mode340521
Node: Job Control349543
Node: Job Control Basics350003
Node: Job Control Builtins355180
Node: Job Control Variables361143
Node: Command Line Editing362323
Node: Introduction and Notation364030
Node: Readline Interaction365677
Node: Readline Bare Essentials366868
Node: Readline Movement Commands368689
Node: Readline Killing Commands369689
Node: Readline Arguments371670
Node: Searching372730
Node: Readline Init File374962
Node: Readline Init File Syntax376247
Node: Conditional Init Constructs401188
Node: Sample Init File405556
Node: Bindable Readline Commands408680
Node: Commands For Moving409908
Node: Commands For History412138
Node: Commands For Text417346
Node: Commands For Killing421483
Node: Numeric Arguments424287
Node: Commands For Completion425442
Node: Keyboard Macros429761
Node: Miscellaneous Commands430465
Node: Readline vi Mode437122
Node: Programmable Completion438077
Node: Programmable Completion Builtins446037
Node: A Programmable Completion Example457606
Node: Using History Interactively462954
Node: Bash History Facilities463638
Node: Bash History Builtins466753
Node: History Interaction471999
Node: Event Designators476327
Node: Word Designators477913
Node: Modifiers479902
Node: Installing Bash481814
Node: Basic Installation482951
Node: Compilers and Options486833
Node: Compiling For Multiple Architectures487586
Node: Installation Names489338
Node: Specifying the System Type491575
Node: Sharing Defaults492324
Node: Operation Controls493041
Node: Optional Features494063
Node: Reporting Bugs505868
Node: Major Differences From The Bourne Shell507220
Node: GNU Free Documentation License526958
Node: Indexes552138
Node: Builtin Index552592
Node: Reserved Word Index559693
Node: Variable Index562141
Node: Function Index579275
Node: Concept Index593134

End Tag Table
+22 -21
View File
@@ -1,11 +1,12 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024/MacPorts 2024.70613_0) (preloaded format=pdfetex 2024.4.9) 23 APR 2024 17:29
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/MacPorts 2023.66589_3) (preloaded format=pdfetex 2024.1.2) 12 JUN 2024 15:53
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\input /usr/local/src/bash/bash-20240422/doc/bashref.texi
(/usr/local/src/bash/bash-20240422/doc/bashref.texi
(/usr/local/src/bash/bash-20240422/doc/texinfo.tex
**\input /usr/local/src/bash/bash-20240609/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20240609/doc/bashref.texi
(/usr/local/src/bash/bash-20240609/doc/bashref.texi
(/usr/local/src/bash/bash-20240609/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -161,15 +162,15 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/local/src/bash/bash-20240422/doc/version.texi) [1{/opt/local/var/db/texmf
(/usr/local/src/bash/bash-20240609/doc/version.texi) [1{/opt/local/var/db/texmf
/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/usr/local/build/bash/bash-20240422/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20240422/doc/bashref.toc)
(/usr/local/build/bash/bash-20240422/doc/bashref.toc) Chapter 1
(/usr/local/build/bash/bash-20240609/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20240609/doc/bashref.toc)
(/usr/local/build/bash/bash-20240609/doc/bashref.toc) Chapter 1
\openout0 = `bashref.toc'.
(/usr/local/build/bash/bash-20240422/doc/bashref.aux)
(/usr/local/build/bash/bash-20240609/doc/bashref.aux)
\openout1 = `bashref.aux'.
Chapter 2 [1] [2]
@@ -230,7 +231,7 @@ live/fonts/enc/dvips/cm-super/cm-super-t1.enc}] [20] [21] [22] [23] [24]
[49] [50] [51] [52]
[53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66] [67]
[68]
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5441--5441
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5446--5446
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -243,7 +244,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5441--5441
.etc.
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5442--5442
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5447--5447
[]@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -262,7 +263,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5442--5442
[119] [120]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20240422/lib/readline/doc/rluser.texi
(/usr/local/src/bash/bash-20240609/lib/readline/doc/rluser.texi
Chapter 8 [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] [131]
[132]
Underfull \hbox (badness 7540) in paragraph at lines 882--888
@@ -312,10 +313,10 @@ gnored[]
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20240422/lib/readline/doc/hsuser.texi Chapter 9
(/usr/local/src/bash/bash-20240609/lib/readline/doc/hsuser.texi Chapter 9
[158] [159] [160] [161] [162] [163]) Chapter 10 [164] [165] [166] [167]
[168]
Underfull \hbox (badness 10000) in paragraph at lines 9827--9836
Underfull \hbox (badness 10000) in paragraph at lines 9844--9853
[]@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem
entation[]@textrm '[],
@@ -328,7 +329,7 @@ entation[]@textrm '[],
.etc.
Underfull \hbox (badness 10000) in paragraph at lines 9827--9836
Underfull \hbox (badness 10000) in paragraph at lines 9844--9853
@textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t
extrm '[], `@texttt strict-posix-default[]@textrm '[], and
@@ -344,17 +345,17 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
[178] [179] Appendix C [180]
texinfo.tex: doing @include of fdl.texi
(/usr/local/src/bash/bash-20240422/doc/fdl.texi
(/usr/local/src/bash/bash-20240609/doc/fdl.texi
[181] [182] [183] [184] [185] [186] [187]) Appendix D [188] [189] [190]
[191] [192] [193] [194] [195] [196] [197] )
Here is how much of TeX's memory you used:
4105 strings out of 495840
47629 string characters out of 6171739
143243 words of memory out of 5000000
143252 words of memory out of 5000000
5048 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
701 hyphenation exceptions out of 8191
16i,6n,16p,331b,983s stack positions out of 10000i,1000n,20000p,200000b,200000s
16i,6n,16p,389b,983s stack positions out of 10000i,1000n,20000p,200000b,200000s
</opt/local/share/texmf-texlive/font
s/type1/public/amsfonts/cm/cmbx12.pfb></opt/local/share/texmf-texlive/fonts/typ
e1/public/amsfonts/cm/cmcsc10.pfb></opt/local/share/texmf-texlive/fonts/type1/p
@@ -371,10 +372,10 @@ texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb></opt/local/share/texmf
-texlive/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texli
ve/fonts/type1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fon
ts/type1/public/cm-super/sfrm1440.pfb>
Output written on bashref.pdf (203 pages, 819186 bytes).
Output written on bashref.pdf (203 pages, 820685 bytes).
PDF statistics:
2834 PDF objects out of 2984 (max. 8388607)
2584 compressed objects within 26 object streams
2835 PDF objects out of 2984 (max. 8388607)
2585 compressed objects within 26 object streams
331 named destinations out of 1000 (max. 500000)
1157 words of extra memory for PDF output out of 10000 (max. 10000000)
BIN
View File
Binary file not shown.
+11 -1
View File
@@ -6688,18 +6688,28 @@ or @samp{-}, which reverses the sort order from ascending to descending,
followed by a sort specifier.
The valid sort specifiers are
@samp{name},
@samp{numeric},
@samp{size},
@samp{mtime},
@samp{atime},
@samp{ctime},
and
@samp{blocks},
which sort the files on name, file size, modification time, access time,
which sort the files on name, names in numeric rather than lexicographic order,
file size, modification time, access time,
inode 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 @code{-mtime} sorts the results in descending
order by modification time (newest first).
The @samp{numeric} 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 @samp{numeric}, names containing non-digits sort after all
the all-digit names and are sorted by name using the traditional behavior.
A sort specifier of @samp{nosort} disables sorting completely; the results
are returned in the order they are read from the file system,
and any leading @samp{-} is ignored.
+3 -3
View File
@@ -62,7 +62,7 @@
@numsecentry{Bash Builtin Commands}{4.2}{Bash Builtins}{57}
@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{69}
@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{69}
@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{73}
@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{74}
@numsecentry{Special Builtins}{4.4}{Special Builtins}{80}
@numchapentry{Shell Variables}{5}{Shell Variables}{81}
@numsecentry{Bourne Shell Variables}{5.1}{Bourne Shell Variables}{81}
@@ -107,9 +107,9 @@
@numsubsecentry{Commands For Manipulating The History}{8.4.2}{Commands For History}{140}
@numsubsecentry{Commands For Changing Text}{8.4.3}{Commands For Text}{142}
@numsubsecentry{Killing And Yanking}{8.4.4}{Commands For Killing}{143}
@numsubsecentry{Specifying Numeric Arguments}{8.4.5}{Numeric Arguments}{144}
@numsubsecentry{Specifying Numeric Arguments}{8.4.5}{Numeric Arguments}{145}
@numsubsecentry{Letting Readline Type For You}{8.4.6}{Commands For Completion}{145}
@numsubsecentry{Keyboard Macros}{8.4.7}{Keyboard Macros}{146}
@numsubsecentry{Keyboard Macros}{8.4.7}{Keyboard Macros}{147}
@numsubsecentry{Some Miscellaneous Commands}{8.4.8}{Miscellaneous Commands}{147}
@numsecentry{Readline vi Mode}{8.5}{Readline vi Mode}{149}
@numsecentry{Programmable Completion}{8.6}{Programmable Completion}{150}
+7 -7
View File
@@ -80,14 +80,14 @@
\entry{histchars}{88}{\code {histchars}}
\entry{HISTCMD}{88}{\code {HISTCMD}}
\entry{HISTCONTROL}{88}{\code {HISTCONTROL}}
\entry{HISTFILE}{88}{\code {HISTFILE}}
\entry{HISTFILE}{89}{\code {HISTFILE}}
\entry{HISTFILESIZE}{89}{\code {HISTFILESIZE}}
\entry{HISTIGNORE}{89}{\code {HISTIGNORE}}
\entry{HISTSIZE}{89}{\code {HISTSIZE}}
\entry{HISTTIMEFORMAT}{89}{\code {HISTTIMEFORMAT}}
\entry{HOSTFILE}{89}{\code {HOSTFILE}}
\entry{HOSTNAME}{89}{\code {HOSTNAME}}
\entry{HOSTTYPE}{89}{\code {HOSTTYPE}}
\entry{HOSTNAME}{90}{\code {HOSTNAME}}
\entry{HOSTTYPE}{90}{\code {HOSTTYPE}}
\entry{IGNOREEOF}{90}{\code {IGNOREEOF}}
\entry{INPUTRC}{90}{\code {INPUTRC}}
\entry{INSIDE_EMACS}{90}{\code {INSIDE_EMACS}}
@@ -100,8 +100,8 @@
\entry{LC_TIME}{90}{\code {LC_TIME}}
\entry{LINENO}{90}{\code {LINENO}}
\entry{LINES}{90}{\code {LINES}}
\entry{MACHTYPE}{90}{\code {MACHTYPE}}
\entry{MAILCHECK}{90}{\code {MAILCHECK}}
\entry{MACHTYPE}{91}{\code {MACHTYPE}}
\entry{MAILCHECK}{91}{\code {MAILCHECK}}
\entry{MAPFILE}{91}{\code {MAPFILE}}
\entry{OLDPWD}{91}{\code {OLDPWD}}
\entry{OPTERR}{91}{\code {OPTERR}}
@@ -113,7 +113,7 @@
\entry{PROMPT_DIRTRIM}{91}{\code {PROMPT_DIRTRIM}}
\entry{PS0}{91}{\code {PS0}}
\entry{PS3}{91}{\code {PS3}}
\entry{PS4}{91}{\code {PS4}}
\entry{PS4}{92}{\code {PS4}}
\entry{PWD}{92}{\code {PWD}}
\entry{RANDOM}{92}{\code {RANDOM}}
\entry{READLINE_ARGUMENT}{92}{\code {READLINE_ARGUMENT}}
@@ -125,7 +125,7 @@
\entry{SHELL}{92}{\code {SHELL}}
\entry{SHELLOPTS}{92}{\code {SHELLOPTS}}
\entry{SHLVL}{92}{\code {SHLVL}}
\entry{SRANDOM}{92}{\code {SRANDOM}}
\entry{SRANDOM}{93}{\code {SRANDOM}}
\entry{TIMEFORMAT}{93}{\code {TIMEFORMAT}}
\entry{TMOUT}{93}{\code {TMOUT}}
\entry{TMPDIR}{93}{\code {TMPDIR}}
+7 -7
View File
@@ -107,7 +107,7 @@
\entry{\code {histchars}}{88}
\entry{\code {HISTCMD}}{88}
\entry{\code {HISTCONTROL}}{88}
\entry{\code {HISTFILE}}{88}
\entry{\code {HISTFILE}}{89}
\entry{\code {HISTFILESIZE}}{89}
\entry{\code {HISTIGNORE}}{89}
\entry{\code {history-preserve-point}}{129}
@@ -117,8 +117,8 @@
\entry{\code {HOME}}{81}
\entry{\code {horizontal-scroll-mode}}{129}
\entry{\code {HOSTFILE}}{89}
\entry{\code {HOSTNAME}}{89}
\entry{\code {HOSTTYPE}}{89}
\entry{\code {HOSTNAME}}{90}
\entry{\code {HOSTTYPE}}{90}
\initial {I}
\entry{\code {IFS}}{81}
\entry{\code {IGNOREEOF}}{90}
@@ -139,9 +139,9 @@
\entry{\code {LINENO}}{90}
\entry{\code {LINES}}{90}
\initial {M}
\entry{\code {MACHTYPE}}{90}
\entry{\code {MACHTYPE}}{91}
\entry{\code {MAIL}}{81}
\entry{\code {MAILCHECK}}{90}
\entry{\code {MAILCHECK}}{91}
\entry{\code {MAILPATH}}{81}
\entry{\code {MAPFILE}}{91}
\entry{\code {mark-modified-lines}}{130}
@@ -168,7 +168,7 @@
\entry{\code {PS1}}{81}
\entry{\code {PS2}}{81}
\entry{\code {PS3}}{91}
\entry{\code {PS4}}{91}
\entry{\code {PS4}}{92}
\entry{\code {PWD}}{92}
\initial {R}
\entry{\code {RANDOM}}{92}
@@ -188,7 +188,7 @@
\entry{\code {show-all-if-unmodified}}{131}
\entry{\code {show-mode-in-prompt}}{132}
\entry{\code {skip-completed-text}}{132}
\entry{\code {SRANDOM}}{92}
\entry{\code {SRANDOM}}{93}
\initial {T}
\entry{\code {TEXTDOMAIN}}{8}
\entry{\code {TEXTDOMAINDIR}}{8}
+14 -2
View File
@@ -71,6 +71,19 @@ extern void rl_set_screen_size (int, int);
#endif
extern void sh_set_lines_and_columns (int, int);
#ifndef HAVE_TCGETWINSIZE
int
tcgetwinsize (int fd, struct winsize *wp)
{
#if defined (TIOCGWINSZ)
return (ioctl (fd, TIOCGWINSZ, wp));
#else
errno = EINVAL;
return -1;
#endif
}
#endif
void
get_new_window_size (int from_sig, int *rp, int *cp)
{
@@ -79,8 +92,7 @@ get_new_window_size (int from_sig, int *rp, int *cp)
int tty;
tty = input_tty ();
if (tty >= 0 && (ioctl (tty, TIOCGWINSZ, &win) == 0) &&
win.ws_row > 0 && win.ws_col > 0)
if (tty >= 0 && (tcgetwinsize (tty, &win) == 0) && win.ws_row > 0 && win.ws_col > 0)
{
sh_set_lines_and_columns (win.ws_row, win.ws_col);
#if defined (READLINE)
+48 -4
View File
@@ -679,6 +679,7 @@ static STRING_INT_ALIST sorttypes[] = {
{ "atime", SORT_ATIME },
{ "ctime", SORT_CTIME },
{ "blocks", SORT_BLOCKS },
{ "numeric", SORT_NUMERIC },
{ "nosort", SORT_NOSORT },
{ (char *)NULL, -1 }
};
@@ -758,13 +759,16 @@ globsort_namecmp (char **s1, char **s2)
static int
globsort_sizecmp (struct globsort_t *g1, struct globsort_t *g2)
{
return ((glob_sorttype < SORT_REVERSE) ? GENCMP(g1->st.size, g2->st.size) : GENCMP(g2->st.size, g1->st.size));
int x;
x = (glob_sorttype < SORT_REVERSE) ? GENCMP(g1->st.size, g2->st.size) : GENCMP(g2->st.size, g1->st.size);
return (x == 0) ? (globsort_namecmp (&g1->name, &g2->name)) : x;
}
static int
globsort_timecmp (struct globsort_t *g1, struct globsort_t *g2)
{
int t;
int t, x;
struct timespec t1, t2;
t = (glob_sorttype < SORT_REVERSE) ? glob_sorttype : glob_sorttype - SORT_REVERSE;
@@ -784,13 +788,50 @@ globsort_timecmp (struct globsort_t *g1, struct globsort_t *g2)
t2 = g2->st.ctime;
}
return ((glob_sorttype < SORT_REVERSE) ? timespec_cmp (t1, t2) : timespec_cmp (t2, t1));
x = (glob_sorttype < SORT_REVERSE) ? timespec_cmp (t1, t2) : timespec_cmp (t2, t1);
return (x == 0) ? (globsort_namecmp (&g1->name, &g2->name)) : x;
}
static int
globsort_blockscmp (struct globsort_t *g1, struct globsort_t *g2)
{
return (glob_sorttype < SORT_REVERSE ? GENCMP(g1->st.blocks, g2->st.blocks) : GENCMP(g2->st.blocks, g1->st.blocks));
int x;
x = (glob_sorttype < SORT_REVERSE) ? GENCMP(g1->st.blocks, g2->st.blocks) : GENCMP(g2->st.blocks, g1->st.blocks);
return (x == 0) ? (globsort_namecmp (&g1->name, &g2->name)) : x;
}
static inline int
gs_checknum (char *string, intmax_t *val)
{
int v;
intmax_t i;
v = all_digits (string);
if (v)
*val = strtoimax (string, (char **)NULL, 10);
return v;
}
static int
globsort_numericcmp (struct globsort_t *g1, struct globsort_t *g2)
{
intmax_t i1, i2;
int v1, v2, x;
/* like valid_number but doesn't allow leading/trailing whitespace or sign */
v1 = gs_checknum (g1->name, &i1);
v2 = gs_checknum (g2->name, &i2);
if (v1 && v2) /* both valid numbers */
/* Don't need to fall back to name comparison here */
return (glob_sorttype < SORT_REVERSE) ? GENCMP(i1, i2) : GENCMP(i2, i1);
else if (v1 == 0 && v2 == 0) /* neither valid numbers */
return (globsort_namecmp (&g1->name, &g2->name));
else if (v1 != 0 && v2 == 0)
return (glob_sorttype < SORT_REVERSE) ? -1 : 1;
else
return (glob_sorttype < SORT_REVERSE) ? 1 : -1;
}
#undef GENCMP
@@ -849,6 +890,9 @@ globsort_sortarray (struct globsort_t *garray, size_t len)
case SORT_BLOCKS:
sortfunc = (QSFUNC *)globsort_blockscmp;
break;
case SORT_NUMERIC:
sortfunc = (QSFUNC *)globsort_numericcmp;
break;
default:
internal_error (_("invalid glob sort type"));
break;
+2 -1
View File
@@ -112,7 +112,8 @@ extern void ignore_glob_matches (char **);
#define SORT_ATIME 4
#define SORT_CTIME 5
#define SORT_BLOCKS 6
#define SORT_NOSORT 7
#define SORT_NUMERIC 7
#define SORT_NOSORT 8
#define SORT_REVERSE 128
+3 -7
View File
@@ -3468,15 +3468,11 @@ do_compound_assignment (const char *name, char *value, int flags)
return ((SHELL_VAR *)0);
}
/* In a function but forcing assignment in global context. CHKLOCAL means to
check for an existing local variable first. */
check for an existing local variable first */
else if (mkglobal && variable_context)
{
v = chklocal ? find_variable (name) : 0;
/* XXX - if we want to make chklocal search previous scopes, change here 2024/06/04 */
if (v && (local_p (v) == 0 || v->context != variable_context))
v = 0;
if (v == 0)
v = find_global_variable (name);
/* Changed to find variables at previous local scopes 6/12/2024 */
v = chklocal ? find_variable (name) : find_global_variable (name);
if (v && ASSIGN_DISALLOWED (v, flags))
{
if (readonly_p (v))
+2
View File
@@ -141,6 +141,8 @@ mksyntax.dSYM mksignames.o mailcheck.o make_cmd.o mksignames mksyntax
mksyntax mksignames make_cmd.o mailcheck.o mksignames.o mksyntax.dSYM
mksyntax.dSYM mksignames.o mailcheck.o make_cmd.o mksignames mksyntax
aa ab ac
ac ab aa
argv[1] = <a>
argv[2] = <abc>
argv[3] = <abd>
+8
View File
@@ -65,5 +65,13 @@ echo m*
GLOBSORT=-size
echo m*
# all zero-length files, so secondary sort on name
touch aa ab ac
GLOBSORT=size
echo a*
# secondary sorting preserves reverse ordering
GLOBSORT=-size
echo a*
cd $OLDPWD
rm -rf $TDIR
+1 -1
View File
@@ -16,7 +16,7 @@ LANG=C
SHELLSTART=$(date +%s)
SECS=1275250155
export TZ=EST5EDT
export TZ=EST5EDT,M3.2.0/2,M11.1.0/2 # ugh
case $SHELLSTART in
*s*) SHELLSTART=$EPOCHSECONDS ; DATESECS=false ;; # take a shot
+30
View File
@@ -328,6 +328,36 @@ after unset f1: x = local
f1: x = local
after unset f1: x = unset
1009: after posix f1: x = global
global initial
declare -- string
declare -i int
declare -a array
inside init_vars acting on previous scope
./varenv25.sub: line 26: local: string: not found
./varenv25.sub: line 26: local: int: not found
./varenv25.sub: line 26: local: array: not found
inside foo, after init_vars
declare -r string="foo"
declare -ir int="100"
declare -ar array=([0]="1" [1]="2")
global after foo
declare -- string
declare -i int
declare -a array
init_vars2
./varenv25.sub: line 51: local: int: not found
foo2, after init_vars2
declare -ir int="142"
global after calling foo2
declare -i int
inside init_vars acting on previous scope
./varenv25.sub: line 26: local: string: not found
./varenv25.sub: line 26: local: int: not found
./varenv25.sub: line 26: local: array: not found
global values after foo placeholder
declare -r string="foo"
declare -ir int="100"
declare -ar array=([0]="1" [1]="2")
a=z
a=b
a=z
+1
View File
@@ -262,6 +262,7 @@ ${THIS_SH} ./varenv21.sub
${THIS_SH} ./varenv22.sub
${THIS_SH} ./varenv23.sub
${THIS_SH} ./varenv24.sub
${THIS_SH} ./varenv25.sub
# make sure variable scoping is done right
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
+73
View File
@@ -0,0 +1,73 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# post-bash-5.2 changes to make readonly/export operate on arrays at previous
# local scopes the way they operate on scalars
declare string
declare -i int
declare -a array
init_vars ()
{
readonly string="foo" readonly int=100 readonly array=(1 2)
# Print the (hopefully) readonly variables
echo inside init_vars acting on previous scope
local -p string int array
}
echo global initial
declare -p string int array
# make readonly operate on local variables at a previous context
foo ()
{
local string ; local -i int ; local -a array
init_vars
echo inside foo, after init_vars
local -p string int array
}
foo
echo global after foo
declare -p string int array
unset -f foo
init_vars2 ()
{
readonly int=100+42
echo init_vars2
local -p int # previous scope, not local here
}
foo2 ()
{
local -i int
init_vars2
echo foo2, after init_vars2
local -p int
}
foo2
echo global after calling foo2
declare -p int
foo3()
{
init_vars
}
foo3
echo global values after foo placeholder
declare -p string int array