signal. If we are at a point where readline has installed its
signal handlers, check for signals readline handles
From a patch from Grisha Levit <grishalevit@gmail.com>
+
+ 2/21
+ ----
+subst.c
+ - make_internal_declare: now takes two strings of option arguments:
+ those to turn on (`-') and those to turn off (`+')
+ - expand_declaration_argument: simplify the code; handle `-' and `+'
+ optionsns; always call make_internal_declare
+ From a patch from Grisha Levit <grishalevit@gmail.com>
+
+ 2/22
+ ----
+aclocal.m4
+ - add additional character to test for broken wcwidth (0x200b)
+
+lib/readline/display.c
+ - update_line: use IS_COMBINING_CHAR instead of UNICODE_COMBINING_CHAR
+ plus WCWIDTH; it doesn't make sense on systems where wcwidth isn't
+ broken
setlocale(LC_ALL, "en_US.UTF-8");
w = wcwidth (0x0301);
+ if (w != 0)
+ exit (0);
+ w = wcwidth (0x200b);
exit (w == 0); /* exit 0 if wcwidth broken */
}
]])], [bash_cv_wcwidth_broken=yes], [bash_cv_wcwidth_broken=no],
Otherwise, the current value of the specified resource is printed. If
no option is given, then -f is assumed.
-Values are in 1024-byte increments, except for -t, which is in seconds,
--p, which is in increments of 512 bytes, and -u, which is an unscaled
-number of processes.
+Values are in 1024-byte increments, except for -t, which is in seconds;
+-p, which is in increments of 512 bytes; -R, which is in microseconds;
+-b, which is in bytes; and -e, -i, -k, -n, -q, -r, -u, -x, and -P,
+which accept unscaled values.
Exit Status:
Returns success unless an invalid option is supplied or an error occurs.
setlocale(LC_ALL, "en_US.UTF-8");
w = wcwidth (0x0301);
+ if (w != 0)
+ exit (0);
+ w = wcwidth (0x200b);
exit (w == 0); /* exit 0 if wcwidth broken */
}
H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE after reading any startup files.
H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE
A colon-separated list of patterns used to decide which command
- lines should be saved on the history list. Each pattern is an-
- chored at the beginning of the line and must match the complete
- line (b\bba\bas\bsh\bh will not implicitly append a "*\b*"). Each pattern is
- tested against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bN-\b-
- T\bTR\bRO\bOL\bL are applied. In addition to the normal shell pattern
- matching characters, "&\b&" matches the previous history line. A
- backslash will escape the "&\b&"; the backslash is removed before
- attempting a match. The second and subsequent lines of a multi-
- line compound command are not tested, and are added to the his-
- tory regardless of the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The pattern match-
- ing honors the setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell option.
+ lines should be saved on the history list. If a command line
+ matches one of the patterns in the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE, it is
+ not saved on the history list. Each pattern is anchored at the
+ beginning of the line and must match the complete line (b\bba\bas\bsh\bh
+ will not implicitly append a "*\b*"). Each pattern is tested
+ against the line after the checks specified by H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL are
+ applied. In addition to the normal shell pattern matching char-
+ acters, "&\b&" matches the previous history line. A backslash will
+ escape the "&\b&"; the backslash is removed before attempting a
+ match. The second and subsequent lines of a multi-line compound
+ command are not tested, and are added to the history regardless
+ of the value of H\bHI\bIS\bST\bTI\bIG\bGN\bNO\bOR\bRE\bE. The pattern matching honors the
+ setting of the e\bex\bxt\btg\bgl\blo\bob\bb shell option.
H\bHI\bIS\bST\bTS\bSI\bIZ\bZE\bE
The number of commands to remember in the command history (see
H\bHI\bIS\bST\bTO\bOR\bRY\bY below). If the value is 0, commands are not saved in
There may be only one active coprocess at a time.
-GNU Bash 5.3 2024 February 5 _\bB_\bA_\bS_\bH(1)
+GNU Bash 5.3 2024 February 19 _\bB_\bA_\bS_\bH(1)
This is bash.info, produced by makeinfo version 7.1 from bashref.texi.
This text is a brief description of the features that are present in the
-Bash shell (version 5.3, 2 February 2024).
+Bash shell (version 5.3, 19 February 2024).
- This is Edition 5.3, last updated 2 February 2024, of ‘The GNU Bash
+ This is Edition 5.3, last updated 19 February 2024, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.3.
Copyright © 1988-2023 Free Software Foundation, Inc.
*************
This text is a brief description of the features that are present in the
-Bash shell (version 5.3, 2 February 2024). The Bash home page is
+Bash shell (version 5.3, 19 February 2024). The Bash home page is
<http://www.gnu.org/software/bash/>.
- This is Edition 5.3, last updated 2 February 2024, of ‘The GNU Bash
+ This is Edition 5.3, last updated 19 February 2024, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.3.
Bash contains features that appear in other popular shells, and some
‘HISTIGNORE’
A colon-separated list of patterns used to decide which command
- lines should be saved on the history list. Each pattern is
- anchored at the beginning of the line and must match the complete
- line (Bash will not implicitly append a ‘*’). Each pattern is
- tested against the line after the checks specified by ‘HISTCONTROL’
- are applied. In addition to the normal shell pattern matching
- characters, ‘&’ matches the previous history line. ‘&’ may be
- escaped using a backslash; the backslash is removed before
- attempting a match. The second and subsequent lines of a
- multi-line compound command are not tested, and are added to the
- history regardless of the value of ‘HISTIGNORE’. The pattern
- matching honors the setting of the ‘extglob’ shell option.
+ lines should be saved on the history list. If a command line
+ matches one of the patterns in the value of ‘HISTIGNORE’, it is not
+ saved on the history list. Each pattern is anchored at the
+ beginning of the line and must match the complete line (Bash will
+ not implicitly append a ‘*’). Each pattern is tested against the
+ line after the checks specified by ‘HISTCONTROL’ are applied. In
+ addition to the normal shell pattern matching characters, ‘&’
+ matches the previous history line. ‘&’ may be escaped using a
+ backslash; the backslash is removed before attempting a match. The
+ second and subsequent lines of a multi-line compound command are
+ not tested, and are added to the history regardless of the value of
+ ‘HISTIGNORE’. The pattern matching honors the setting of the
+ ‘extglob’ shell option.
‘HISTIGNORE’ subsumes the function of ‘HISTCONTROL’. A pattern of
‘&’ is identical to ‘ignoredups’, and a pattern of ‘[ ]*’ is
(line 214)
* history-size: Readline Init File Syntax.
(line 220)
-* HISTSIZE: Bash Variables. (line 478)
-* HISTTIMEFORMAT: Bash Variables. (line 485)
+* HISTSIZE: Bash Variables. (line 480)
+* HISTTIMEFORMAT: Bash Variables. (line 487)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 229)
-* HOSTFILE: Bash Variables. (line 494)
-* HOSTNAME: Bash Variables. (line 505)
-* HOSTTYPE: Bash Variables. (line 508)
+* HOSTFILE: Bash Variables. (line 496)
+* HOSTNAME: Bash Variables. (line 507)
+* HOSTTYPE: Bash Variables. (line 510)
* IFS: Bourne Shell Variables.
(line 18)
-* IGNOREEOF: Bash Variables. (line 511)
+* IGNOREEOF: Bash Variables. (line 513)
* input-meta: Readline Init File Syntax.
(line 238)
-* INPUTRC: Bash Variables. (line 521)
-* INSIDE_EMACS: Bash Variables. (line 525)
+* INPUTRC: Bash Variables. (line 523)
+* INSIDE_EMACS: Bash Variables. (line 527)
* 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 531)
-* LC_ALL: Bash Variables. (line 535)
-* LC_COLLATE: Bash Variables. (line 539)
-* LC_CTYPE: Bash Variables. (line 546)
+* LANG <1>: Bash Variables. (line 533)
+* LC_ALL: Bash Variables. (line 537)
+* LC_COLLATE: Bash Variables. (line 541)
+* LC_CTYPE: Bash Variables. (line 548)
* LC_MESSAGES: Creating Internationalized Scripts.
(line 51)
-* LC_MESSAGES <1>: Bash Variables. (line 551)
-* LC_NUMERIC: Bash Variables. (line 555)
-* LC_TIME: Bash Variables. (line 559)
-* LINENO: Bash Variables. (line 563)
-* LINES: Bash Variables. (line 568)
-* MACHTYPE: Bash Variables. (line 574)
+* 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)
* MAIL: Bourne Shell Variables.
(line 22)
-* MAILCHECK: Bash Variables. (line 578)
+* MAILCHECK: Bash Variables. (line 580)
* MAILPATH: Bourne Shell Variables.
(line 27)
-* MAPFILE: Bash Variables. (line 586)
+* MAPFILE: Bash Variables. (line 588)
* mark-modified-lines: Readline Init File Syntax.
(line 285)
* mark-symlinked-directories: Readline Init File Syntax.
(line 302)
* meta-flag: Readline Init File Syntax.
(line 238)
-* OLDPWD: Bash Variables. (line 590)
+* OLDPWD: Bash Variables. (line 592)
* OPTARG: Bourne Shell Variables.
(line 34)
-* OPTERR: Bash Variables. (line 593)
+* OPTERR: Bash Variables. (line 595)
* OPTIND: Bourne Shell Variables.
(line 38)
-* OSTYPE: Bash Variables. (line 597)
+* OSTYPE: Bash Variables. (line 599)
* 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 600)
-* POSIXLY_CORRECT: Bash Variables. (line 605)
-* PPID: Bash Variables. (line 615)
-* PROMPT_COMMAND: Bash Variables. (line 619)
-* PROMPT_DIRTRIM: Bash Variables. (line 625)
-* PS0: Bash Variables. (line 631)
+* PIPESTATUS: Bash Variables. (line 602)
+* POSIXLY_CORRECT: Bash Variables. (line 607)
+* PPID: Bash Variables. (line 617)
+* PROMPT_COMMAND: Bash Variables. (line 621)
+* PROMPT_DIRTRIM: Bash Variables. (line 627)
+* PS0: Bash Variables. (line 633)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
-* PS3: Bash Variables. (line 636)
-* PS4: Bash Variables. (line 641)
-* PWD: Bash Variables. (line 649)
-* RANDOM: Bash Variables. (line 652)
-* READLINE_ARGUMENT: Bash Variables. (line 658)
-* READLINE_LINE: Bash Variables. (line 662)
-* READLINE_MARK: Bash Variables. (line 666)
-* READLINE_POINT: Bash Variables. (line 672)
-* REPLY: Bash Variables. (line 676)
+* PS3: Bash Variables. (line 638)
+* PS4: Bash Variables. (line 643)
+* PWD: Bash Variables. (line 651)
+* RANDOM: Bash Variables. (line 654)
+* READLINE_ARGUMENT: Bash Variables. (line 660)
+* READLINE_LINE: Bash Variables. (line 664)
+* READLINE_MARK: Bash Variables. (line 668)
+* READLINE_POINT: Bash Variables. (line 674)
+* REPLY: Bash Variables. (line 678)
* revert-all-at-newline: Readline Init File Syntax.
(line 325)
* search-ignore-case: Readline Init File Syntax.
(line 332)
-* SECONDS: Bash Variables. (line 679)
-* SHELL: Bash Variables. (line 688)
-* SHELLOPTS: Bash Variables. (line 693)
-* SHLVL: Bash Variables. (line 702)
+* SECONDS: Bash Variables. (line 681)
+* SHELL: Bash Variables. (line 690)
+* SHELLOPTS: Bash Variables. (line 695)
+* SHLVL: Bash Variables. (line 704)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 337)
* show-all-if-unmodified: Readline Init File Syntax.
(line 352)
* skip-completed-text: Readline Init File Syntax.
(line 358)
-* SRANDOM: Bash Variables. (line 707)
+* SRANDOM: Bash Variables. (line 709)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
* TEXTDOMAINDIR: Creating Internationalized Scripts.
(line 51)
-* TIMEFORMAT: Bash Variables. (line 716)
-* TMOUT: Bash Variables. (line 754)
-* TMPDIR: Bash Variables. (line 766)
-* UID: Bash Variables. (line 770)
+* TIMEFORMAT: Bash Variables. (line 718)
+* TMOUT: Bash Variables. (line 756)
+* TMPDIR: Bash Variables. (line 768)
+* UID: Bash Variables. (line 772)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 371)
* vi-ins-mode-string: Readline Init File Syntax.
\1f
Tag Table:
-Node: Top\7f899
-Node: Introduction\7f2838
-Node: What is Bash?\7f3051
-Node: What is a shell?\7f4192
-Node: Definitions\7f6771
-Node: Basic Shell Features\7f9947
-Node: Shell Syntax\7f11167
-Node: Shell Operation\7f12194
-Node: Quoting\7f13492
-Node: Escape Character\7f14805
-Node: Single Quotes\7f15303
-Node: Double Quotes\7f15652
-Node: ANSI-C Quoting\7f16995
-Node: Locale Translation\7f18380
-Node: Creating Internationalized Scripts\7f19724
-Node: Comments\7f23922
-Node: Shell Commands\7f24557
-Node: Reserved Words\7f25496
-Node: Simple Commands\7f26361
-Node: Pipelines\7f27020
-Node: Lists\7f30083
-Node: Compound Commands\7f31955
-Node: Looping Constructs\7f32964
-Node: Conditional Constructs\7f35508
-Node: Command Grouping\7f50412
-Node: Coprocesses\7f51899
-Node: GNU Parallel\7f54595
-Node: Shell Functions\7f55513
-Node: Shell Parameters\7f63619
-Node: Positional Parameters\7f68152
-Node: Special Parameters\7f69087
-Node: Shell Expansions\7f72394
-Node: Brace Expansion\7f74583
-Node: Tilde Expansion\7f77246
-Node: Shell Parameter Expansion\7f80012
-Node: Command Substitution\7f99036
-Node: Arithmetic Expansion\7f102569
-Node: Process Substitution\7f103534
-Node: Word Splitting\7f104671
-Node: Filename Expansion\7f106812
-Node: Pattern Matching\7f109908
-Node: Quote Removal\7f115141
-Node: Redirections\7f115445
-Node: Executing Commands\7f125254
-Node: Simple Command Expansion\7f125921
-Node: Command Search and Execution\7f128032
-Node: Command Execution Environment\7f130440
-Node: Environment\7f133749
-Node: Exit Status\7f135453
-Node: Signals\7f137238
-Node: Shell Scripts\7f140852
-Node: Shell Builtin Commands\7f143944
-Node: Bourne Shell Builtins\7f146055
-Node: Bash Builtins\7f170459
-Node: Modifying Shell Behavior\7f205064
-Node: The Set Builtin\7f205406
-Node: The Shopt Builtin\7f216921
-Node: Special Builtins\7f233657
-Node: Shell Variables\7f234646
-Node: Bourne Shell Variables\7f235080
-Node: Bash Variables\7f237273
-Node: Bash Features\7f273695
-Node: Invoking Bash\7f274709
-Node: Bash Startup Files\7f281108
-Node: Interactive Shells\7f286420
-Node: What is an Interactive Shell?\7f286828
-Node: Is this Shell Interactive?\7f287494
-Node: Interactive Shell Behavior\7f288318
-Node: Bash Conditional Expressions\7f292072
-Node: Shell Arithmetic\7f297246
-Node: Aliases\7f300328
-Node: Arrays\7f303283
-Node: The Directory Stack\7f310082
-Node: Directory Stack Builtins\7f310879
-Node: Controlling the Prompt\7f315328
-Node: The Restricted Shell\7f318466
-Node: Bash POSIX Mode\7f321253
-Node: Shell Compatibility Mode\7f338734
-Node: Job Control\7f347220
-Node: Job Control Basics\7f347677
-Node: Job Control Builtins\7f352851
-Node: Job Control Variables\7f358811
-Node: Command Line Editing\7f359988
-Node: Introduction and Notation\7f361692
-Node: Readline Interaction\7f363336
-Node: Readline Bare Essentials\7f364524
-Node: Readline Movement Commands\7f366342
-Node: Readline Killing Commands\7f367339
-Node: Readline Arguments\7f369317
-Node: Searching\7f370374
-Node: Readline Init File\7f372603
-Node: Readline Init File Syntax\7f373885
-Node: Conditional Init Constructs\7f398823
-Node: Sample Init File\7f403188
-Node: Bindable Readline Commands\7f406309
-Node: Commands For Moving\7f407534
-Node: Commands For History\7f409634
-Node: Commands For Text\7f414717
-Node: Commands For Killing\7f418792
-Node: Numeric Arguments\7f421593
-Node: Commands For Completion\7f422745
-Node: Keyboard Macros\7f427061
-Node: Miscellaneous Commands\7f427762
-Node: Readline vi Mode\7f434416
-Node: Programmable Completion\7f435368
-Node: Programmable Completion Builtins\7f443325
-Node: A Programmable Completion Example\7f454891
-Node: Using History Interactively\7f460236
-Node: Bash History Facilities\7f460917
-Node: Bash History Builtins\7f464029
-Node: History Interaction\7f469272
-Node: Event Designators\7f473597
-Node: Word Designators\7f475180
-Node: Modifiers\7f477166
-Node: Installing Bash\7f479075
-Node: Basic Installation\7f480209
-Node: Compilers and Options\7f484088
-Node: Compiling For Multiple Architectures\7f484838
-Node: Installation Names\7f486587
-Node: Specifying the System Type\7f488821
-Node: Sharing Defaults\7f489567
-Node: Operation Controls\7f490281
-Node: Optional Features\7f491300
-Node: Reporting Bugs\7f503102
-Node: Major Differences From The Bourne Shell\7f504451
-Node: GNU Free Documentation License\7f522260
-Node: Indexes\7f547437
-Node: Builtin Index\7f547888
-Node: Reserved Word Index\7f554986
-Node: Variable Index\7f557431
-Node: Function Index\7f574562
-Node: Concept Index\7f588418
+Node: Top\7f901
+Node: Introduction\7f2842
+Node: What is Bash?\7f3055
+Node: What is a shell?\7f4196
+Node: Definitions\7f6775
+Node: Basic Shell Features\7f9951
+Node: Shell Syntax\7f11171
+Node: Shell Operation\7f12198
+Node: Quoting\7f13496
+Node: Escape Character\7f14809
+Node: Single Quotes\7f15307
+Node: Double Quotes\7f15656
+Node: ANSI-C Quoting\7f16999
+Node: Locale Translation\7f18384
+Node: Creating Internationalized Scripts\7f19728
+Node: Comments\7f23926
+Node: Shell Commands\7f24561
+Node: Reserved Words\7f25500
+Node: Simple Commands\7f26365
+Node: Pipelines\7f27024
+Node: Lists\7f30087
+Node: Compound Commands\7f31959
+Node: Looping Constructs\7f32968
+Node: Conditional Constructs\7f35512
+Node: Command Grouping\7f50416
+Node: Coprocesses\7f51903
+Node: GNU Parallel\7f54599
+Node: Shell Functions\7f55517
+Node: Shell Parameters\7f63623
+Node: Positional Parameters\7f68156
+Node: Special Parameters\7f69091
+Node: Shell Expansions\7f72398
+Node: Brace Expansion\7f74587
+Node: Tilde Expansion\7f77250
+Node: Shell Parameter Expansion\7f80016
+Node: Command Substitution\7f99040
+Node: Arithmetic Expansion\7f102573
+Node: Process Substitution\7f103538
+Node: Word Splitting\7f104675
+Node: Filename Expansion\7f106816
+Node: Pattern Matching\7f109912
+Node: Quote Removal\7f115145
+Node: Redirections\7f115449
+Node: Executing Commands\7f125258
+Node: Simple Command Expansion\7f125925
+Node: Command Search and Execution\7f128036
+Node: Command Execution Environment\7f130444
+Node: Environment\7f133753
+Node: Exit Status\7f135457
+Node: Signals\7f137242
+Node: Shell Scripts\7f140856
+Node: Shell Builtin Commands\7f143948
+Node: Bourne Shell Builtins\7f146059
+Node: Bash Builtins\7f170463
+Node: Modifying Shell Behavior\7f205068
+Node: The Set Builtin\7f205410
+Node: The Shopt Builtin\7f216925
+Node: Special Builtins\7f233661
+Node: Shell Variables\7f234650
+Node: Bourne Shell Variables\7f235084
+Node: Bash Variables\7f237277
+Node: Bash Features\7f273827
+Node: Invoking Bash\7f274841
+Node: Bash Startup Files\7f281240
+Node: Interactive Shells\7f286552
+Node: What is an Interactive Shell?\7f286960
+Node: Is this Shell Interactive?\7f287626
+Node: Interactive Shell Behavior\7f288450
+Node: Bash Conditional Expressions\7f292204
+Node: Shell Arithmetic\7f297378
+Node: Aliases\7f300460
+Node: Arrays\7f303415
+Node: The Directory Stack\7f310214
+Node: Directory Stack Builtins\7f311011
+Node: Controlling the Prompt\7f315460
+Node: The Restricted Shell\7f318598
+Node: Bash POSIX Mode\7f321385
+Node: Shell Compatibility Mode\7f338866
+Node: Job Control\7f347352
+Node: Job Control Basics\7f347809
+Node: Job Control Builtins\7f352983
+Node: Job Control Variables\7f358943
+Node: Command Line Editing\7f360120
+Node: Introduction and Notation\7f361824
+Node: Readline Interaction\7f363468
+Node: Readline Bare Essentials\7f364656
+Node: Readline Movement Commands\7f366474
+Node: Readline Killing Commands\7f367471
+Node: Readline Arguments\7f369449
+Node: Searching\7f370506
+Node: Readline Init File\7f372735
+Node: Readline Init File Syntax\7f374017
+Node: Conditional Init Constructs\7f398955
+Node: Sample Init File\7f403320
+Node: Bindable Readline Commands\7f406441
+Node: Commands For Moving\7f407666
+Node: Commands For History\7f409766
+Node: Commands For Text\7f414849
+Node: Commands For Killing\7f418924
+Node: Numeric Arguments\7f421725
+Node: Commands For Completion\7f422877
+Node: Keyboard Macros\7f427193
+Node: Miscellaneous Commands\7f427894
+Node: Readline vi Mode\7f434548
+Node: Programmable Completion\7f435500
+Node: Programmable Completion Builtins\7f443457
+Node: A Programmable Completion Example\7f455023
+Node: Using History Interactively\7f460368
+Node: Bash History Facilities\7f461049
+Node: Bash History Builtins\7f464161
+Node: History Interaction\7f469404
+Node: Event Designators\7f473729
+Node: Word Designators\7f475312
+Node: Modifiers\7f477298
+Node: Installing Bash\7f479207
+Node: Basic Installation\7f480341
+Node: Compilers and Options\7f484220
+Node: Compiling For Multiple Architectures\7f484970
+Node: Installation Names\7f486719
+Node: Specifying the System Type\7f488953
+Node: Sharing Defaults\7f489699
+Node: Operation Controls\7f490413
+Node: Optional Features\7f491432
+Node: Reporting Bugs\7f503234
+Node: Major Differences From The Bourne Shell\7f504583
+Node: GNU Free Documentation License\7f522392
+Node: Indexes\7f547569
+Node: Builtin Index\7f548020
+Node: Reserved Word Index\7f555118
+Node: Variable Index\7f557563
+Node: Function Index\7f574694
+Node: Concept Index\7f588550
\1f
End Tag Table
bashref.texi.
This text is a brief description of the features that are present in the
-Bash shell (version 5.3, 2 February 2024).
+Bash shell (version 5.3, 19 February 2024).
- This is Edition 5.3, last updated 2 February 2024, of ‘The GNU Bash
+ This is Edition 5.3, last updated 19 February 2024, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.3.
Copyright © 1988-2023 Free Software Foundation, Inc.
*************
This text is a brief description of the features that are present in the
-Bash shell (version 5.3, 2 February 2024). The Bash home page is
+Bash shell (version 5.3, 19 February 2024). The Bash home page is
<http://www.gnu.org/software/bash/>.
- This is Edition 5.3, last updated 2 February 2024, of ‘The GNU Bash
+ This is Edition 5.3, last updated 19 February 2024, of ‘The GNU Bash
Reference Manual’, for ‘Bash’, Version 5.3.
Bash contains features that appear in other popular shells, and some
‘HISTIGNORE’
A colon-separated list of patterns used to decide which command
- lines should be saved on the history list. Each pattern is
- anchored at the beginning of the line and must match the complete
- line (Bash will not implicitly append a ‘*’). Each pattern is
- tested against the line after the checks specified by ‘HISTCONTROL’
- are applied. In addition to the normal shell pattern matching
- characters, ‘&’ matches the previous history line. ‘&’ may be
- escaped using a backslash; the backslash is removed before
- attempting a match. The second and subsequent lines of a
- multi-line compound command are not tested, and are added to the
- history regardless of the value of ‘HISTIGNORE’. The pattern
- matching honors the setting of the ‘extglob’ shell option.
+ lines should be saved on the history list. If a command line
+ matches one of the patterns in the value of ‘HISTIGNORE’, it is not
+ saved on the history list. Each pattern is anchored at the
+ beginning of the line and must match the complete line (Bash will
+ not implicitly append a ‘*’). Each pattern is tested against the
+ line after the checks specified by ‘HISTCONTROL’ are applied. In
+ addition to the normal shell pattern matching characters, ‘&’
+ matches the previous history line. ‘&’ may be escaped using a
+ backslash; the backslash is removed before attempting a match. The
+ second and subsequent lines of a multi-line compound command are
+ not tested, and are added to the history regardless of the value of
+ ‘HISTIGNORE’. The pattern matching honors the setting of the
+ ‘extglob’ shell option.
‘HISTIGNORE’ subsumes the function of ‘HISTCONTROL’. A pattern of
‘&’ is identical to ‘ignoredups’, and a pattern of ‘[ ]*’ is
(line 214)
* history-size: Readline Init File Syntax.
(line 220)
-* HISTSIZE: Bash Variables. (line 478)
-* HISTTIMEFORMAT: Bash Variables. (line 485)
+* HISTSIZE: Bash Variables. (line 480)
+* HISTTIMEFORMAT: Bash Variables. (line 487)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 229)
-* HOSTFILE: Bash Variables. (line 494)
-* HOSTNAME: Bash Variables. (line 505)
-* HOSTTYPE: Bash Variables. (line 508)
+* HOSTFILE: Bash Variables. (line 496)
+* HOSTNAME: Bash Variables. (line 507)
+* HOSTTYPE: Bash Variables. (line 510)
* IFS: Bourne Shell Variables.
(line 18)
-* IGNOREEOF: Bash Variables. (line 511)
+* IGNOREEOF: Bash Variables. (line 513)
* input-meta: Readline Init File Syntax.
(line 238)
-* INPUTRC: Bash Variables. (line 521)
-* INSIDE_EMACS: Bash Variables. (line 525)
+* INPUTRC: Bash Variables. (line 523)
+* INSIDE_EMACS: Bash Variables. (line 527)
* 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 531)
-* LC_ALL: Bash Variables. (line 535)
-* LC_COLLATE: Bash Variables. (line 539)
-* LC_CTYPE: Bash Variables. (line 546)
+* LANG <1>: Bash Variables. (line 533)
+* LC_ALL: Bash Variables. (line 537)
+* LC_COLLATE: Bash Variables. (line 541)
+* LC_CTYPE: Bash Variables. (line 548)
* LC_MESSAGES: Creating Internationalized Scripts.
(line 51)
-* LC_MESSAGES <1>: Bash Variables. (line 551)
-* LC_NUMERIC: Bash Variables. (line 555)
-* LC_TIME: Bash Variables. (line 559)
-* LINENO: Bash Variables. (line 563)
-* LINES: Bash Variables. (line 568)
-* MACHTYPE: Bash Variables. (line 574)
+* 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)
* MAIL: Bourne Shell Variables.
(line 22)
-* MAILCHECK: Bash Variables. (line 578)
+* MAILCHECK: Bash Variables. (line 580)
* MAILPATH: Bourne Shell Variables.
(line 27)
-* MAPFILE: Bash Variables. (line 586)
+* MAPFILE: Bash Variables. (line 588)
* mark-modified-lines: Readline Init File Syntax.
(line 285)
* mark-symlinked-directories: Readline Init File Syntax.
(line 302)
* meta-flag: Readline Init File Syntax.
(line 238)
-* OLDPWD: Bash Variables. (line 590)
+* OLDPWD: Bash Variables. (line 592)
* OPTARG: Bourne Shell Variables.
(line 34)
-* OPTERR: Bash Variables. (line 593)
+* OPTERR: Bash Variables. (line 595)
* OPTIND: Bourne Shell Variables.
(line 38)
-* OSTYPE: Bash Variables. (line 597)
+* OSTYPE: Bash Variables. (line 599)
* 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 600)
-* POSIXLY_CORRECT: Bash Variables. (line 605)
-* PPID: Bash Variables. (line 615)
-* PROMPT_COMMAND: Bash Variables. (line 619)
-* PROMPT_DIRTRIM: Bash Variables. (line 625)
-* PS0: Bash Variables. (line 631)
+* PIPESTATUS: Bash Variables. (line 602)
+* POSIXLY_CORRECT: Bash Variables. (line 607)
+* PPID: Bash Variables. (line 617)
+* PROMPT_COMMAND: Bash Variables. (line 621)
+* PROMPT_DIRTRIM: Bash Variables. (line 627)
+* PS0: Bash Variables. (line 633)
* PS1: Bourne Shell Variables.
(line 48)
* PS2: Bourne Shell Variables.
(line 53)
-* PS3: Bash Variables. (line 636)
-* PS4: Bash Variables. (line 641)
-* PWD: Bash Variables. (line 649)
-* RANDOM: Bash Variables. (line 652)
-* READLINE_ARGUMENT: Bash Variables. (line 658)
-* READLINE_LINE: Bash Variables. (line 662)
-* READLINE_MARK: Bash Variables. (line 666)
-* READLINE_POINT: Bash Variables. (line 672)
-* REPLY: Bash Variables. (line 676)
+* PS3: Bash Variables. (line 638)
+* PS4: Bash Variables. (line 643)
+* PWD: Bash Variables. (line 651)
+* RANDOM: Bash Variables. (line 654)
+* READLINE_ARGUMENT: Bash Variables. (line 660)
+* READLINE_LINE: Bash Variables. (line 664)
+* READLINE_MARK: Bash Variables. (line 668)
+* READLINE_POINT: Bash Variables. (line 674)
+* REPLY: Bash Variables. (line 678)
* revert-all-at-newline: Readline Init File Syntax.
(line 325)
* search-ignore-case: Readline Init File Syntax.
(line 332)
-* SECONDS: Bash Variables. (line 679)
-* SHELL: Bash Variables. (line 688)
-* SHELLOPTS: Bash Variables. (line 693)
-* SHLVL: Bash Variables. (line 702)
+* SECONDS: Bash Variables. (line 681)
+* SHELL: Bash Variables. (line 690)
+* SHELLOPTS: Bash Variables. (line 695)
+* SHLVL: Bash Variables. (line 704)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 337)
* show-all-if-unmodified: Readline Init File Syntax.
(line 352)
* skip-completed-text: Readline Init File Syntax.
(line 358)
-* SRANDOM: Bash Variables. (line 707)
+* SRANDOM: Bash Variables. (line 709)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
* TEXTDOMAINDIR: Creating Internationalized Scripts.
(line 51)
-* TIMEFORMAT: Bash Variables. (line 716)
-* TMOUT: Bash Variables. (line 754)
-* TMPDIR: Bash Variables. (line 766)
-* UID: Bash Variables. (line 770)
+* TIMEFORMAT: Bash Variables. (line 718)
+* TMOUT: Bash Variables. (line 756)
+* TMPDIR: Bash Variables. (line 768)
+* UID: Bash Variables. (line 772)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 371)
* vi-ins-mode-string: Readline Init File Syntax.
\1f
Tag Table:
-Node: Top\7f902
-Node: Introduction\7f2844
-Node: What is Bash?\7f3060
-Node: What is a shell?\7f4204
-Node: Definitions\7f6786
-Node: Basic Shell Features\7f9965
-Node: Shell Syntax\7f11188
-Node: Shell Operation\7f12218
-Node: Quoting\7f13519
-Node: Escape Character\7f14835
-Node: Single Quotes\7f15336
-Node: Double Quotes\7f15688
-Node: ANSI-C Quoting\7f17034
-Node: Locale Translation\7f18422
-Node: Creating Internationalized Scripts\7f19769
-Node: Comments\7f23970
-Node: Shell Commands\7f24608
-Node: Reserved Words\7f25550
-Node: Simple Commands\7f26418
-Node: Pipelines\7f27080
-Node: Lists\7f30146
-Node: Compound Commands\7f32021
-Node: Looping Constructs\7f33033
-Node: Conditional Constructs\7f35580
-Node: Command Grouping\7f50487
-Node: Coprocesses\7f51977
-Node: GNU Parallel\7f54676
-Node: Shell Functions\7f55597
-Node: Shell Parameters\7f63706
-Node: Positional Parameters\7f68242
-Node: Special Parameters\7f69180
-Node: Shell Expansions\7f72490
-Node: Brace Expansion\7f74682
-Node: Tilde Expansion\7f77348
-Node: Shell Parameter Expansion\7f80117
-Node: Command Substitution\7f99144
-Node: Arithmetic Expansion\7f102680
-Node: Process Substitution\7f103648
-Node: Word Splitting\7f104788
-Node: Filename Expansion\7f106932
-Node: Pattern Matching\7f110031
-Node: Quote Removal\7f115267
-Node: Redirections\7f115574
-Node: Executing Commands\7f125386
-Node: Simple Command Expansion\7f126056
-Node: Command Search and Execution\7f128170
-Node: Command Execution Environment\7f130581
-Node: Environment\7f133893
-Node: Exit Status\7f135600
-Node: Signals\7f137388
-Node: Shell Scripts\7f141005
-Node: Shell Builtin Commands\7f144100
-Node: Bourne Shell Builtins\7f146214
-Node: Bash Builtins\7f170621
-Node: Modifying Shell Behavior\7f205229
-Node: The Set Builtin\7f205574
-Node: The Shopt Builtin\7f217092
-Node: Special Builtins\7f233831
-Node: Shell Variables\7f234823
-Node: Bourne Shell Variables\7f235260
-Node: Bash Variables\7f237456
-Node: Bash Features\7f273881
-Node: Invoking Bash\7f274898
-Node: Bash Startup Files\7f281300
-Node: Interactive Shells\7f286615
-Node: What is an Interactive Shell?\7f287026
-Node: Is this Shell Interactive?\7f287695
-Node: Interactive Shell Behavior\7f288522
-Node: Bash Conditional Expressions\7f292279
-Node: Shell Arithmetic\7f297456
-Node: Aliases\7f300541
-Node: Arrays\7f303499
-Node: The Directory Stack\7f310301
-Node: Directory Stack Builtins\7f311101
-Node: Controlling the Prompt\7f315553
-Node: The Restricted Shell\7f318694
-Node: Bash POSIX Mode\7f321484
-Node: Shell Compatibility Mode\7f338968
-Node: Job Control\7f347457
-Node: Job Control Basics\7f347917
-Node: Job Control Builtins\7f353094
-Node: Job Control Variables\7f359057
-Node: Command Line Editing\7f360237
-Node: Introduction and Notation\7f361944
-Node: Readline Interaction\7f363591
-Node: Readline Bare Essentials\7f364782
-Node: Readline Movement Commands\7f366603
-Node: Readline Killing Commands\7f367603
-Node: Readline Arguments\7f369584
-Node: Searching\7f370644
-Node: Readline Init File\7f372876
-Node: Readline Init File Syntax\7f374161
-Node: Conditional Init Constructs\7f399102
-Node: Sample Init File\7f403470
-Node: Bindable Readline Commands\7f406594
-Node: Commands For Moving\7f407822
-Node: Commands For History\7f409925
-Node: Commands For Text\7f415011
-Node: Commands For Killing\7f419089
-Node: Numeric Arguments\7f421893
-Node: Commands For Completion\7f423048
-Node: Keyboard Macros\7f427367
-Node: Miscellaneous Commands\7f428071
-Node: Readline vi Mode\7f434728
-Node: Programmable Completion\7f435683
-Node: Programmable Completion Builtins\7f443643
-Node: A Programmable Completion Example\7f455212
-Node: Using History Interactively\7f460560
-Node: Bash History Facilities\7f461244
-Node: Bash History Builtins\7f464359
-Node: History Interaction\7f469605
-Node: Event Designators\7f473933
-Node: Word Designators\7f475519
-Node: Modifiers\7f477508
-Node: Installing Bash\7f479420
-Node: Basic Installation\7f480557
-Node: Compilers and Options\7f484439
-Node: Compiling For Multiple Architectures\7f485192
-Node: Installation Names\7f486944
-Node: Specifying the System Type\7f489181
-Node: Sharing Defaults\7f489930
-Node: Operation Controls\7f490647
-Node: Optional Features\7f491669
-Node: Reporting Bugs\7f503474
-Node: Major Differences From The Bourne Shell\7f504826
-Node: GNU Free Documentation License\7f522638
-Node: Indexes\7f547818
-Node: Builtin Index\7f548272
-Node: Reserved Word Index\7f555373
-Node: Variable Index\7f557821
-Node: Function Index\7f574955
-Node: Concept Index\7f588814
+Node: Top\7f904
+Node: Introduction\7f2848
+Node: What is Bash?\7f3064
+Node: What is a shell?\7f4208
+Node: Definitions\7f6790
+Node: Basic Shell Features\7f9969
+Node: Shell Syntax\7f11192
+Node: Shell Operation\7f12222
+Node: Quoting\7f13523
+Node: Escape Character\7f14839
+Node: Single Quotes\7f15340
+Node: Double Quotes\7f15692
+Node: ANSI-C Quoting\7f17038
+Node: Locale Translation\7f18426
+Node: Creating Internationalized Scripts\7f19773
+Node: Comments\7f23974
+Node: Shell Commands\7f24612
+Node: Reserved Words\7f25554
+Node: Simple Commands\7f26422
+Node: Pipelines\7f27084
+Node: Lists\7f30150
+Node: Compound Commands\7f32025
+Node: Looping Constructs\7f33037
+Node: Conditional Constructs\7f35584
+Node: Command Grouping\7f50491
+Node: Coprocesses\7f51981
+Node: GNU Parallel\7f54680
+Node: Shell Functions\7f55601
+Node: Shell Parameters\7f63710
+Node: Positional Parameters\7f68246
+Node: Special Parameters\7f69184
+Node: Shell Expansions\7f72494
+Node: Brace Expansion\7f74686
+Node: Tilde Expansion\7f77352
+Node: Shell Parameter Expansion\7f80121
+Node: Command Substitution\7f99148
+Node: Arithmetic Expansion\7f102684
+Node: Process Substitution\7f103652
+Node: Word Splitting\7f104792
+Node: Filename Expansion\7f106936
+Node: Pattern Matching\7f110035
+Node: Quote Removal\7f115271
+Node: Redirections\7f115578
+Node: Executing Commands\7f125390
+Node: Simple Command Expansion\7f126060
+Node: Command Search and Execution\7f128174
+Node: Command Execution Environment\7f130585
+Node: Environment\7f133897
+Node: Exit Status\7f135604
+Node: Signals\7f137392
+Node: Shell Scripts\7f141009
+Node: Shell Builtin Commands\7f144104
+Node: Bourne Shell Builtins\7f146218
+Node: Bash Builtins\7f170625
+Node: Modifying Shell Behavior\7f205233
+Node: The Set Builtin\7f205578
+Node: The Shopt Builtin\7f217096
+Node: Special Builtins\7f233835
+Node: Shell Variables\7f234827
+Node: Bourne Shell Variables\7f235264
+Node: Bash Variables\7f237460
+Node: Bash Features\7f274013
+Node: Invoking Bash\7f275030
+Node: Bash Startup Files\7f281432
+Node: Interactive Shells\7f286747
+Node: What is an Interactive Shell?\7f287158
+Node: Is this Shell Interactive?\7f287827
+Node: Interactive Shell Behavior\7f288654
+Node: Bash Conditional Expressions\7f292411
+Node: Shell Arithmetic\7f297588
+Node: Aliases\7f300673
+Node: Arrays\7f303631
+Node: The Directory Stack\7f310433
+Node: Directory Stack Builtins\7f311233
+Node: Controlling the Prompt\7f315685
+Node: The Restricted Shell\7f318826
+Node: Bash POSIX Mode\7f321616
+Node: Shell Compatibility Mode\7f339100
+Node: Job Control\7f347589
+Node: Job Control Basics\7f348049
+Node: Job Control Builtins\7f353226
+Node: Job Control Variables\7f359189
+Node: Command Line Editing\7f360369
+Node: Introduction and Notation\7f362076
+Node: Readline Interaction\7f363723
+Node: Readline Bare Essentials\7f364914
+Node: Readline Movement Commands\7f366735
+Node: Readline Killing Commands\7f367735
+Node: Readline Arguments\7f369716
+Node: Searching\7f370776
+Node: Readline Init File\7f373008
+Node: Readline Init File Syntax\7f374293
+Node: Conditional Init Constructs\7f399234
+Node: Sample Init File\7f403602
+Node: Bindable Readline Commands\7f406726
+Node: Commands For Moving\7f407954
+Node: Commands For History\7f410057
+Node: Commands For Text\7f415143
+Node: Commands For Killing\7f419221
+Node: Numeric Arguments\7f422025
+Node: Commands For Completion\7f423180
+Node: Keyboard Macros\7f427499
+Node: Miscellaneous Commands\7f428203
+Node: Readline vi Mode\7f434860
+Node: Programmable Completion\7f435815
+Node: Programmable Completion Builtins\7f443775
+Node: A Programmable Completion Example\7f455344
+Node: Using History Interactively\7f460692
+Node: Bash History Facilities\7f461376
+Node: Bash History Builtins\7f464491
+Node: History Interaction\7f469737
+Node: Event Designators\7f474065
+Node: Word Designators\7f475651
+Node: Modifiers\7f477640
+Node: Installing Bash\7f479552
+Node: Basic Installation\7f480689
+Node: Compilers and Options\7f484571
+Node: Compiling For Multiple Architectures\7f485324
+Node: Installation Names\7f487076
+Node: Specifying the System Type\7f489313
+Node: Sharing Defaults\7f490062
+Node: Operation Controls\7f490779
+Node: Optional Features\7f491801
+Node: Reporting Bugs\7f503606
+Node: Major Differences From The Bourne Shell\7f504958
+Node: GNU Free Documentation License\7f522770
+Node: Indexes\7f547950
+Node: Builtin Index\7f548404
+Node: Reserved Word Index\7f555505
+Node: Variable Index\7f557953
+Node: Function Index\7f575087
+Node: Concept Index\7f588946
\1f
End Tag Table
assume it's a combining character and back one up so the two base
characters no longer compare equivalently. */
t = MBRTOWC (&wc, ofd, mb_cur_max, &ps);
+#if 0
if (t > 0 && UNICODE_COMBINING_CHAR (wc) && WCWIDTH (wc) == 0)
+#else
+ if (t > 0 && IS_COMBINING_CHAR (wc))
+#endif
{
old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY);
new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY);
if (find_non_zero)
{
- tmp = MBRTOWC (&wc, string + point, strlen (string + point), &ps);
+ len = strlen (string + point);
+ tmp = MBRTOWC (&wc, string + point, len, &ps);
while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && WCWIDTH (wc) == 0)
{
point += tmp;
- tmp = MBRTOWC (&wc, string + point, strlen (string + point), &ps);
+ len -= tmp;
+ tmp = MBRTOWC (&wc, string + point, len, &ps);
}
}
save = prev;
/* Move back until we're not in the middle of a multibyte char */
+#if 0
if (UTF8_MBCHAR (b))
{
while (prev > 0 && (b = (unsigned char)string[--prev]) && UTF8_MBCHAR (b))
;
}
+#else
+ while (prev > 0 && (b = (unsigned char)string[--prev]) && UTF8_MBFIRSTCHAR (b) == 0)
+ ;
+#endif
if (UTF8_MBFIRSTCHAR (b))
{
}
}
-/* Unicode combining characters range from U+0300 to U+036F */
-#define UNICODE_COMBINING_CHAR(x) ((x) >= 768 && (x) <= 879)
+/* Unicode combining characters as of version 15.1 */
+#define UNICODE_COMBINING_CHAR(x) \
+ (((x) >= 0x0300 && (x) <= 0x036F) || \
+ ((x) >= 0x1AB0 && (x) <= 0x1AFF) || \
+ ((x) >= 0x1DC0 && (x) <= 0x1DFF) || \
+ ((x) >= 0x20D0 && (x) <= 0x20FF) || \
+ ((x) >= 0xFE20 && (x) <= 0xFE2F))
#if defined (WCWIDTH_BROKEN)
-# define WCWIDTH(wc) ((_rl_utf8locale && UNICODE_COMBINING_CHAR(wc)) ? 0 : _rl_wcwidth(wc))
+# define WCWIDTH(wc) ((_rl_utf8locale && UNICODE_COMBINING_CHAR((int)wc)) ? 0 : _rl_wcwidth(wc))
#else
# define WCWIDTH(wc) _rl_wcwidth(wc)
#endif
# define IS_COMBINING_CHAR(x) (WCWIDTH(x) == 0)
#endif
+#define IS_BASE_CHAR(x) (iswgraph(x) && WCWIDTH(x) > 0)
+
#define UTF8_SINGLEBYTE(c) (((c) & 0x80) == 0)
#define UTF8_MBFIRSTCHAR(c) (((c) & 0xc0) == 0xc0)
#define UTF8_MBCHAR(c) (((c) & 0xc0) == 0x80)
static WORD_LIST *brace_expand_word_list (WORD_LIST *, int);
#endif
#if defined (ARRAY_VARS)
-static int make_internal_declare (char *, char *, char *);
+static int make_internal_declare (const char *, const char *, const char *, const char *);
static void expand_compound_assignment_word (WORD_LIST *, int);
static WORD_LIST *expand_declaration_argument (WORD_LIST *, WORD_LIST *);
#endif
the list of options to supply to `declare'. CMD is the declaration command
we are expanding right now; it's unused currently. */
static int
-make_internal_declare (char *word, char *option, char *cmd)
+make_internal_declare (const char *word, const char *opts_on, const char *opts_off, const char *cmd)
{
int t, r;
WORD_LIST *wl;
}
wl = make_word_list (w, (WORD_LIST *)NULL);
- wl = make_word_list (make_word (option), wl);
+ if (*opts_on)
+ wl = make_word_list (make_word (opts_on), wl);
+ if (*opts_off)
+ wl = make_word_list (make_word (opts_off), wl);
r = declare_builtin (wl);
static WORD_LIST *
expand_declaration_argument (WORD_LIST *tlist, WORD_LIST *wcmd)
{
- char opts[16], omap[128];
- int t, opti, oind, skip, inheriting;
+ char opts_on[16], opts_off[16], omap[128];
+ int t, i_on, i_off, oind, skip, inheriting;
WORD_LIST *l;
- inheriting = localvar_inherit;
- opti = 0;
- if (tlist->word->flags & (W_ASSIGNASSOC|W_ASSNGLOBAL|W_CHKLOCAL|W_ASSIGNARRAY))
- opts[opti++] = '-';
+ memset (omap, '\0', sizeof (omap));
- if ((tlist->word->flags & (W_ASSIGNASSOC|W_ASSNGLOBAL)) == (W_ASSIGNASSOC|W_ASSNGLOBAL))
- {
- opts[opti++] = 'g';
- opts[opti++] = 'A';
- }
- else if (tlist->word->flags & W_ASSIGNASSOC)
- {
- opts[opti++] = 'A';
- }
- else if ((tlist->word->flags & (W_ASSIGNARRAY|W_ASSNGLOBAL)) == (W_ASSIGNARRAY|W_ASSNGLOBAL))
- {
- opts[opti++] = 'g';
- opts[opti++] = 'a';
- }
+ if (tlist->word->flags & W_ASSIGNASSOC)
+ omap['A'] = 1;
else if (tlist->word->flags & W_ASSIGNARRAY)
- {
- opts[opti++] = 'a';
- }
- else if (tlist->word->flags & W_ASSNGLOBAL)
- opts[opti++] = 'g';
+ omap['a'] = 1;
+ if (tlist->word->flags & W_ASSNGLOBAL)
+ omap['g'] = 1;
if (tlist->word->flags & W_CHKLOCAL)
- opts[opti++] = 'G';
+ omap['G'] = 1;
/* If we have special handling note the integer attribute and others
that transform the value upon assignment. What we do is take all
of the option arguments and scan through them looking for options
- that cause such transformations, and add them to the `opts' array. */
+ that cause such transformations, and add them to either the `opts_on'
+ or `opts_off' array as appropriate. */
- memset (omap, '\0', sizeof (omap));
for (l = wcmd->next; l != tlist; l = l->next)
{
int optchar;
if (l->word->word[0] != '-' && l->word->word[0] != '+')
break; /* non-option argument */
- if (l->word->word[0] == '-' && l->word->word[1] == '-' && l->word->word[2] == 0)
+ if (l->word->word[1] == 0)
+ break; /* handle `local -'; let `declare +' be an error */
+
+ if (ISOPTION (l->word->word, '-'))
break; /* -- signals end of options */
+
optchar = l->word->word[0];
for (oind = 1; l->word->word[oind]; oind++)
switch (l->word->word[oind])
{
case 'I':
- inheriting = 1;
case 'i':
case 'l':
case 'u':
case 'c':
- omap[l->word->word[oind]] = 1;
- if (opti == 0)
- opts[opti++] = optchar;
+ omap[l->word->word[oind]] |= (optchar == '-' ? 1 : 2);
break;
default:
break;
}
}
+ i_on = i_off = 0;
for (oind = 0; oind < sizeof (omap); oind++)
- if (omap[oind])
- opts[opti++] = oind;
-
- /* If there are no -a/-A options, but we have a compound assignment,
- we have a choice: we can set opts[0]='-', opts[1]='a', since the
- default is to create an indexed array, and call
- make_internal_declare with that, or we can just skip the -a and let
- declare_builtin deal with it. Once we're here, we're better set
- up for the latter, since we don't want to deal with looking up
- any existing variable here -- better to let declare_builtin do it.
- We need the variable created, though, especially if it's local, so
- we get the scoping right before we call do_word_assignment.
- To ensure that make_local_declare gets called, we add `--' if there
- aren't any options. */
- if ((tlist->word->flags & (W_ASSIGNASSOC|W_ASSIGNARRAY)) == 0)
{
- if (opti == 0)
+ if (omap[oind] & 1) /* on options */
{
- opts[opti++] = '-';
- opts[opti++] = '-';
+ if (i_on == 0)
+ opts_on[i_on++] = '-';
+ opts_on[i_on++] = oind;
+ }
+ if (omap[oind] & 2) /* off options */
+ {
+ if (i_off == 0)
+ opts_off[i_off++] = '+';
+ opts_off[i_off++] = oind;
}
}
- opts[opti] = '\0';
+
+ opts_on[i_on] = opts_off[i_off] = '\0';
/* This isn't perfect, but it's a start. Improvements later. We expand
tlist->word->word and single-quote the results to avoid multiple
expand_compound_assignment_word (tlist, (tlist->word->flags & W_ASSIGNASSOC) ? 1 : 0);
skip = 0;
- if (opti > 0)
+ /* We always call make_internal_declare */
+ t = make_internal_declare (tlist->word->word, opts_on, opts_off, wcmd ? wcmd->word->word : (char *)0);
+ if (t != EXECUTION_SUCCESS)
{
- t = make_internal_declare (tlist->word->word, opts, wcmd ? wcmd->word->word : (char *)0);
- if (t != EXECUTION_SUCCESS)
- {
- last_command_exit_value = t;
- if (tlist->word->flags & W_FORCELOCAL) /* non-fatal error */
- skip = 1;
- else
- exp_jump_to_top_level (DISCARD);
- }
+ last_command_exit_value = t;
+ if (tlist->word->flags & W_FORCELOCAL) /* non-fatal error */
+ skip = 1;
+ else
+ exp_jump_to_top_level (DISCARD);
}
if (skip == 0)
-./array.tests: line 28: syntax error near unexpected token `&'
-./array.tests: line 28: `test=(first & second)'
+./array.tests: line 34: syntax error near unexpected token `&'
+./array.tests: line 34: `test=(first & second)'
1
abcde
abcde
11
3
bdef hello world test expression test 2
-./array.tests: line 92: readonly: `a[5]': not a valid identifier
+./array.tests: line 98: readonly: `a[5]': not a valid identifier
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
declare -ar c
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
declare -a e=([0]="test")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
-./array.tests: line 116: a: readonly variable
-./array.tests: line 118: b[]: bad array subscript
-./array.tests: line 119: b[*]: bad array subscript
+./array.tests: line 122: a: readonly variable
+./array.tests: line 124: b[]: bad array subscript
+./array.tests: line 125: b[*]: bad array subscript
this
-./array.tests: line 122: c[-2]: bad array subscript
-./array.tests: line 123: c: bad array subscript
+./array.tests: line 128: c[-2]: bad array subscript
+./array.tests: line 129: c: bad array subscript
-./array.tests: line 125: d[7]: cannot assign list to array member
-./array.tests: line 127: []=abcde: bad array subscript
-./array.tests: line 128: [*]=last: cannot assign to non-numeric index
-./array.tests: line 129: [-65]=negative: bad array subscript
+./array.tests: line 131: d[7]: cannot assign list to array member
+./array.tests: line 133: []=abcde: bad array subscript
+./array.tests: line 134: [*]=last: cannot assign to non-numeric index
+./array.tests: line 135: [-65]=negative: bad array subscript
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
declare -a d=([1]="test test")
declare -a e=()
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
-./array.tests: line 137: unset: ps1: not an array variable
-./array.tests: line 141: declare: c: readonly variable
+./array.tests: line 143: unset: ps1: not an array variable
+./array.tests: line 147: declare: c: readonly variable
this of
this is a test of read using arrays
this test
55
49
6 -- 6
-./array.tests: line 232: [-10]: bad array subscript
+./array.tests: line 238: [-10]: bad array subscript
0
42 14 44
grep [ 123 ] *
6 7 9 5
length = 3
value = new1 new2 new3
-./array.tests: line 261: syntax error near unexpected token `&'
-./array.tests: line 261: `badarray=( metacharacters like & need to be quoted in compound assignments)'
-./array.tests: line 265: narray: unbound variable
+./array.tests: line 267: syntax error near unexpected token `&'
+./array.tests: line 267: `badarray=( metacharacters like & need to be quoted in compound assignments)'
+./array.tests: line 271: narray: unbound variable
./array1.sub: line 1: syntax error near unexpected token `('
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
12 14 16 18 20
4414758999202
aaa bbb
-./array.tests: line 315: syntax error near unexpected token `<>'
-./array.tests: line 315: `metas=( <> < > ! )'
-./array.tests: line 316: syntax error near unexpected token `<>'
-./array.tests: line 316: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
+./array.tests: line 321: syntax error near unexpected token `<>'
+./array.tests: line 321: `metas=( <> < > ! )'
+./array.tests: line 322: syntax error near unexpected token `<>'
+./array.tests: line 322: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
abc 3
case 4
abc case if then else 5
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+
+# Filter stdin to remove builtin array variables that are
+# automatically set and possibly contain values that vary.
+ignore_builtin_arrays()
+{
+ grep -v -e BASH_VERSINFO= -e PIPESTATUS= -e GROUPS=
+}
+
# this is needed so that the bad assignments (b[]=bcde, for example) do not
# cause fatal shell errors when in posix mode
set +o posix
set +a
-# The calls to egrep -v are to filter out builtin array variables that are
-# automatically set and possibly contain values that vary.
# first make sure we handle the basics
x=()
echo ${a[*]}
# this should print out values, too
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -a | ignore_builtin_arrays
unset a[7]
echo ${a[*]}
readonly a[5]
readonly a
# these two lines should output `declare' commands
-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
-declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+readonly -a | ignore_builtin_arrays
+declare -ar | ignore_builtin_arrays
# this line should output `readonly' commands, even for arrays
set -o posix
-readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+readonly -a | ignore_builtin_arrays
set +o posix
declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
echo ${b[@]:2:3}
-declare -pa | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -pa | ignore_builtin_arrays
a[3]="this is a test"
unset d[12]
unset e[*]
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -a | ignore_builtin_arrays
ps1='hello'
unset ps1[2]
echo ${vv[@]}
unset vv
-declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS|GROUPS)'
+declare -a | ignore_builtin_arrays
export rv
#set