implementation of printf '%N$' numbered argument conversion specifier, compatible with coreutils

This commit is contained in:
Chet Ramey
2025-12-05 15:50:38 -05:00
parent 5a104e96d8
commit f27bf94a79
29 changed files with 2012 additions and 1428 deletions
+165 -149
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 7.2 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 24 September 2025).
Bash shell (version 5.3, 2 December 2025).
This is Edition 5.3, last updated 24 September 2025, of The GNU Bash
This is Edition 5.3, last updated 2 December 2025, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2025 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 24 September 2025). The Bash home page is
Bash shell (version 5.3, 2 December 2025). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 24 September 2025, of The GNU Bash
This is Edition 5.3, last updated 2 December 2025, of The GNU Bash
Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -4369,7 +4369,7 @@ standard.
The -f option means to load the new builtin command NAME from
shared object FILENAME, on systems that support dynamic loading.
If FILENAME does not contain a slash. Bash will use the value of
If FILENAME does not contain a slash, Bash will use the value of
the BASH_LOADABLES_PATH variable as a colon-separated list of
directories in which to search for FILENAME. The default for
BASH_LOADABLES_PATH is system-dependent, and may include "." to
@@ -4561,12 +4561,25 @@ standard.
the numeric value of the following character, using the current
locale.
Format specifiers may apply to the Nth argument rather than the
next sequential argument. In this case, the % in the format
specifier is replaced by the sequence %N$, where N is a decimal
integer greater than 0, giving the argument number to use as the
operand. The format string should not mix numbered and unnumbered
argument specifiers, though this is allowed. Unnumbered argument
specifiers always refer to the next argument following the last
argument consumed by an unnumbered specifier; numbered argument
specifiers refer to absolute positions in the argument list.
The FORMAT is reused as necessary to consume all of the ARGUMENTS.
If the FORMAT requires more ARGUMENTS than are supplied, the extra
format specifications behave as if a zero value or null string, as
appropriate, had been supplied. The return value is zero on
success, non-zero if an invalid option is supplied or a write or
assignment error occurs.
appropriate, had been supplied. If FORMAT is reused, a numbered
argument specifier %N$ refers to the Nth argument following the
highest numbered argument consumed by the previous use of FORMAT.
The return value is zero on success, non-zero if an invalid option
is supplied or a write or assignment error occurs.
read
read [-Eers] [-a ANAME] [-d DELIM] [-i TEXT] [-n NCHARS]
@@ -7310,6 +7323,9 @@ end of the array, and an index of -1 references the last element.
The += operator appends to an array variable when assigning using
the compound assignment syntax; see *note Shell Parameters:: above.
If one of the word expansions in a compound array assignment unsets
the variable, the results are unspecified.
An array element is referenced using ${NAME[SUBSCRIPT]}. The
braces are required to avoid conflicts with the shell's filename
expansion operators. If the SUBSCRIPT is @ or *, the word expands
@@ -7569,8 +7585,8 @@ can appear in the prompt variables PS0, PS1, PS2, and PS4
\\
A backslash.
\[
Begin a sequence of non-printing characters. Thiss could be used
to embed a terminal control sequence into the prompt.
Begin a sequence of non-printing characters. This could be used to
embed a terminal control sequence into the prompt.
\]
End a sequence of non-printing characters.
@@ -12950,8 +12966,8 @@ D.1 Index of Shell Builtin Commands
(line 71)
* pwd: Bourne Shell Builtins.
(line 265)
* read: Bash Builtins. (line 558)
* readarray: Bash Builtins. (line 669)
* read: Bash Builtins. (line 571)
* readarray: Bash Builtins. (line 682)
* readonly: Bourne Shell Builtins.
(line 277)
* return: Bourne Shell Builtins.
@@ -12960,7 +12976,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 327)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 678)
* source: Bash Builtins. (line 691)
* suspend: Job Control Builtins.
(line 141)
* test: Bourne Shell Builtins.
@@ -12971,12 +12987,12 @@ D.1 Index of Shell Builtin Commands
(line 446)
* true: Bourne Shell Builtins.
(line 512)
* type: Bash Builtins. (line 683)
* typeset: Bash Builtins. (line 720)
* ulimit: Bash Builtins. (line 726)
* type: Bash Builtins. (line 696)
* typeset: Bash Builtins. (line 733)
* ulimit: Bash Builtins. (line 739)
* umask: Bourne Shell Builtins.
(line 517)
* unalias: Bash Builtins. (line 834)
* unalias: Bash Builtins. (line 847)
* unset: Bourne Shell Builtins.
(line 535)
* wait: Job Control Builtins.
@@ -13660,138 +13676,138 @@ D.5 Concept Index

Tag Table:
Node: Top903
Node: Introduction2846
Node: What is Bash?3059
Node: What is a shell?4192
Node: Definitions6802
Node: Basic Shell Features10129
Node: Shell Syntax11353
Node: Shell Operation12380
Node: Quoting13671
Node: Escape Character15009
Node: Single Quotes15544
Node: Double Quotes15893
Node: ANSI-C Quoting17238
Node: Locale Translation18632
Node: Creating Internationalized Scripts20035
Node: Comments24233
Node: Shell Commands25000
Node: Reserved Words25939
Node: Simple Commands27082
Node: Pipelines27744
Node: Lists31000
Node: Compound Commands32920
Node: Looping Constructs33929
Node: Conditional Constructs36478
Node: Command Grouping51615
Node: Coprocesses53107
Node: GNU Parallel55793
Node: Shell Functions56711
Node: Shell Parameters65159
Node: Positional Parameters70060
Node: Special Parameters71150
Node: Shell Expansions74611
Node: Brace Expansion76800
Node: Tilde Expansion80136
Node: Shell Parameter Expansion83091
Node: Command Substitution103738
Node: Arithmetic Expansion107267
Node: Process Substitution108443
Node: Word Splitting109551
Node: Filename Expansion111995
Node: Pattern Matching115219
Node: Quote Removal120985
Node: Redirections121289
Node: Executing Commands131545
Node: Simple Command Expansion132212
Node: Command Search and Execution134320
Node: Command Execution Environment136764
Node: Environment140212
Node: Exit Status142115
Node: Signals144174
Node: Shell Scripts149122
Node: Shell Builtin Commands152420
Node: Bourne Shell Builtins154761
Node: Bash Builtins181480
Node: Modifying Shell Behavior218404
Node: The Set Builtin218746
Node: The Shopt Builtin230740
Node: Special Builtins247793
Node: Shell Variables248782
Node: Bourne Shell Variables249216
Node: Bash Variables251724
Node: Bash Features291008
Node: Invoking Bash292022
Node: Bash Startup Files298606
Node: Interactive Shells303848
Node: What is an Interactive Shell?304256
Node: Is this Shell Interactive?304918
Node: Interactive Shell Behavior305742
Node: Bash Conditional Expressions309503
Node: Shell Arithmetic314920
Node: Aliases318247
Node: Arrays321381
Node: The Directory Stack328969
Node: Directory Stack Builtins329766
Node: Controlling the Prompt334211
Node: The Restricted Shell337096
Node: Bash POSIX Mode339978
Node: Shell Compatibility Mode358925
Node: Job Control367932
Node: Job Control Basics368389
Node: Job Control Builtins374757
Node: Job Control Variables381545
Node: Command Line Editing382776
Node: Introduction and Notation384479
Node: Readline Interaction386831
Node: Readline Bare Essentials388019
Node: Readline Movement Commands389827
Node: Readline Killing Commands390823
Node: Readline Arguments392846
Node: Searching393936
Node: Readline Init File396179
Node: Readline Init File Syntax397482
Node: Conditional Init Constructs424433
Node: Sample Init File428818
Node: Bindable Readline Commands431938
Node: Commands For Moving433476
Node: Commands For History435940
Node: Commands For Text441331
Node: Commands For Killing445456
Node: Numeric Arguments448244
Node: Commands For Completion449396
Node: Keyboard Macros455092
Node: Miscellaneous Commands455793
Node: Readline vi Mode462360
Node: Programmable Completion463337
Node: Programmable Completion Builtins473073
Node: A Programmable Completion Example484810
Node: Using History Interactively490155
Node: Bash History Facilities490836
Node: Bash History Builtins494571
Node: History Interaction501042
Node: Event Designators505992
Node: Word Designators507570
Node: Modifiers509962
Node: Installing Bash511899
Node: Basic Installation513015
Node: Compilers and Options516891
Node: Compiling For Multiple Architectures517641
Node: Installation Names519394
Node: Specifying the System Type521628
Node: Sharing Defaults522374
Node: Operation Controls523088
Node: Optional Features524107
Node: Reporting Bugs536830
Node: Major Differences From The Bourne Shell538187
Node: GNU Free Documentation License559614
Node: Indexes584791
Node: Builtin Index585242
Node: Reserved Word Index592340
Node: Variable Index594785
Node: Function Index612198
Node: Concept Index626193
Node: Top899
Node: Introduction2838
Node: What is Bash?3051
Node: What is a shell?4184
Node: Definitions6794
Node: Basic Shell Features10121
Node: Shell Syntax11345
Node: Shell Operation12372
Node: Quoting13663
Node: Escape Character15001
Node: Single Quotes15536
Node: Double Quotes15885
Node: ANSI-C Quoting17230
Node: Locale Translation18624
Node: Creating Internationalized Scripts20027
Node: Comments24225
Node: Shell Commands24992
Node: Reserved Words25931
Node: Simple Commands27074
Node: Pipelines27736
Node: Lists30992
Node: Compound Commands32912
Node: Looping Constructs33921
Node: Conditional Constructs36470
Node: Command Grouping51607
Node: Coprocesses53099
Node: GNU Parallel55785
Node: Shell Functions56703
Node: Shell Parameters65151
Node: Positional Parameters70052
Node: Special Parameters71142
Node: Shell Expansions74603
Node: Brace Expansion76792
Node: Tilde Expansion80128
Node: Shell Parameter Expansion83083
Node: Command Substitution103730
Node: Arithmetic Expansion107259
Node: Process Substitution108435
Node: Word Splitting109543
Node: Filename Expansion111987
Node: Pattern Matching115211
Node: Quote Removal120977
Node: Redirections121281
Node: Executing Commands131537
Node: Simple Command Expansion132204
Node: Command Search and Execution134312
Node: Command Execution Environment136756
Node: Environment140204
Node: Exit Status142107
Node: Signals144166
Node: Shell Scripts149114
Node: Shell Builtin Commands152412
Node: Bourne Shell Builtins154753
Node: Bash Builtins181472
Node: Modifying Shell Behavior219208
Node: The Set Builtin219550
Node: The Shopt Builtin231544
Node: Special Builtins248597
Node: Shell Variables249586
Node: Bourne Shell Variables250020
Node: Bash Variables252528
Node: Bash Features291812
Node: Invoking Bash292826
Node: Bash Startup Files299410
Node: Interactive Shells304652
Node: What is an Interactive Shell?305060
Node: Is this Shell Interactive?305722
Node: Interactive Shell Behavior306546
Node: Bash Conditional Expressions310307
Node: Shell Arithmetic315724
Node: Aliases319051
Node: Arrays322185
Node: The Directory Stack329888
Node: Directory Stack Builtins330685
Node: Controlling the Prompt335130
Node: The Restricted Shell338014
Node: Bash POSIX Mode340896
Node: Shell Compatibility Mode359843
Node: Job Control368850
Node: Job Control Basics369307
Node: Job Control Builtins375675
Node: Job Control Variables382463
Node: Command Line Editing383694
Node: Introduction and Notation385397
Node: Readline Interaction387749
Node: Readline Bare Essentials388937
Node: Readline Movement Commands390745
Node: Readline Killing Commands391741
Node: Readline Arguments393764
Node: Searching394854
Node: Readline Init File397097
Node: Readline Init File Syntax398400
Node: Conditional Init Constructs425351
Node: Sample Init File429736
Node: Bindable Readline Commands432856
Node: Commands For Moving434394
Node: Commands For History436858
Node: Commands For Text442249
Node: Commands For Killing446374
Node: Numeric Arguments449162
Node: Commands For Completion450314
Node: Keyboard Macros456010
Node: Miscellaneous Commands456711
Node: Readline vi Mode463278
Node: Programmable Completion464255
Node: Programmable Completion Builtins473991
Node: A Programmable Completion Example485728
Node: Using History Interactively491073
Node: Bash History Facilities491754
Node: Bash History Builtins495489
Node: History Interaction501960
Node: Event Designators506910
Node: Word Designators508488
Node: Modifiers510880
Node: Installing Bash512817
Node: Basic Installation513933
Node: Compilers and Options517809
Node: Compiling For Multiple Architectures518559
Node: Installation Names520312
Node: Specifying the System Type522546
Node: Sharing Defaults523292
Node: Operation Controls524006
Node: Optional Features525025
Node: Reporting Bugs537748
Node: Major Differences From The Bourne Shell539105
Node: GNU Free Documentation License560532
Node: Indexes585709
Node: Builtin Index586160
Node: Reserved Word Index593258
Node: Variable Index595703
Node: Function Index613116
Node: Concept Index627111

End Tag Table