control default value of patsub_replacement from config-top.h; documentation updates

This commit is contained in:
Chet Ramey
2023-02-20 11:59:04 -05:00
parent 72c4a0f40d
commit 3b4d12c1a2
11 changed files with 1374 additions and 1268 deletions
+27 -2
View File
@@ -5376,8 +5376,6 @@ lib/readline/histlib.h
lib/readline/histsearch.c
- history_search_internal: anchored searches honor CASEFOLD_SEARCH
2/17
----
lib/readline/histsearch.c
- history_search_internal: searches now honor CASEFOLD_SEARCH
- _hs_history_search: new function, just external interface to
@@ -5393,3 +5391,30 @@ lib/readline/search.c
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
- search-ignore-case: document new bindable variable
2/17
----
config-top.h
- PATSUB_REPLACE_DEFAULT: macro set to 1 or 0 to set the default value
of `patsub_replacement'. Can be overridden by -DPATSUB_REPLACE_DEFAULT=0
in the `make' command
builtins/shopt.def
- reset_shopt_options: reset patsub_replacement to PATSUB_REPLACE_DEFAULT
subst.c
- patsub_replacement: initialize to PATSUB_REPLACE_DEFAULT
parse.y
- shell_getc: only call clearerr(stdin) when yy_stream_get returns EOF
if the shell is currently interactive (interactive != 0)
- shell_getc: if the shell is not interactive (interactive_shell == 0)
and using stdio to read the script (bash_input.type == st_stream),
set shell_input_line_terminator to READERR if ferror(stdin) is true
after yy_stream_get returns EOF
2/20
----
doc/{bash.1,bashref.texi}
- update aliases description based on a bug-bash discussion
- update description of word splitting behavior when IFS is unset
+1 -1
View File
@@ -374,7 +374,7 @@ reset_shopt_options (void)
source_uses_path = promptvars = 1;
varassign_redir_autoclose = 0;
singlequote_translations = 0;
patsub_replacement = 1;
patsub_replacement = PATSUB_REPLACE_DEFAULT;
#if defined (JOB_CONTROL)
check_jobs_at_exit = 0;
+10
View File
@@ -199,3 +199,13 @@
/* Undefine or define to 0 if you don't want to allow associative array
assignment using a compound list of key-value pairs. */
#define ASSOC_KVPAIR_ASSIGNMENT 1
/* Define if you want read errors in non-interactive shells to be fatal
errors instead of the historical practice of treating them as EOF. */
/* #define FATAL_READERROR 1 */
/* Define to 0 if you want the `patsub_replacement' shell option to be disabled
by default. */
#ifndef PATSUB_REPLACE_DEFAULT
#define PATSUB_REPLACE_DEFAULT 1
#endif
+897 -885
View File
File diff suppressed because it is too large Load Diff
+27 -15
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Fri Jan 27 15:18:01 EST 2023
.\" Last Change: Mon Feb 20 09:59:47 EST 2023
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2023 January 27" "GNU Bash 5.2"
.TH BASH 1 "2023 February 20" "GNU Bash 5.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -3648,6 +3648,7 @@ The shell treats each character of
.B IFS
as a delimiter, and splits the results of the other
expansions into words using these characters as field terminators.
.PP
If
.SM
.B IFS
@@ -3656,10 +3657,10 @@ value is exactly
.BR <space><tab><newline> ,
the default, then
sequences of
.BR <space> ,
.BR <tab> ,
.BR space ,
.BR tab ,
and
.B <newline>
.B newline
at the beginning and end of the results of the previous
expansions are ignored, and
any sequence of
@@ -3698,10 +3699,17 @@ A sequence of
.SM
.B IFS
whitespace characters is also treated as a delimiter.
.PP
If the value of
.SM
.B IFS
is null, no word splitting occurs.
If
.SM
.B IFS
is unset, word splitting behaves as if it contained the default value
of
.BR <space><tab><newline> .
.PP
Explicit null arguments (\^\f3"\^"\fP or \^\f3\(aq\^\(aq\fP\^) are retained
and passed to commands as empty strings.
@@ -4389,19 +4397,22 @@ or on file descriptor 0 if
.I n
is not specified. If the file does not exist, it is created.
.SH ALIASES
\fIAliases\fP allow a string to be substituted for a word when it is used
as the first word of a simple command.
The shell maintains a list of aliases that may be set and unset with the
.B alias
and
.B unalias
builtin commands (see
\fIAliases\fP allow a string to be substituted for a word that is in
a position in the input where it can be the first word of a simple
command. Aliases have names and corresponding values that are set
and unset using the \fBalias\fP and \fBunalias\fP builtin commands
(see
.SM
.B SHELL BUILTIN COMMANDS
below).
The first word of each simple command, if unquoted,
is checked to see if it has an
alias. If so, that word is replaced by the text of the alias.
.PP
If the shell reads an unquoted word in the right position, it checks
the word to see if it matches an alias name. If it matches, the shell
replaces the word with the alias value, and reads that value as if it
had been read instead of the word.
The shell doesn't look at any characters following the word before
attempting alias substitution.
.PP
The characters \fB/\fP, \fB$\fP, \fB\`\fP, and \fB=\fP and
any of the shell \fImetacharacters\fP or quoting characters
listed above may not appear in an alias name.
@@ -4417,6 +4428,7 @@ to
for instance, and
.B bash
does not try to recursively expand the replacement text.
.PP
If the last character of the alias value is a
.IR blank ,
then the next command
+190 -176
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 6.8 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 7 February 2023).
Bash shell (version 5.2, 20 February 2023).
This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Copyright (C) 1988-2023 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.2, 7 February 2023). The Bash home page is
Bash shell (version 5.2, 20 February 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Bash contains features that appear in other popular shells, and some
@@ -4038,12 +4038,13 @@ standard.
the variable NAME have a visible scope restricted to that function
and its children. If NAME is '-', the set of shell options is made
local to the function in which 'local' is invoked: shell options
changed using the 'set' builtin inside the function are restored to
their original values when the function returns. The restore is
effected as if a series of 'set' commands were executed to restore
the values that were in place before the function. The return
status is zero unless 'local' is used outside a function, an
invalid NAME is supplied, or NAME is a readonly variable.
changed using the 'set' builtin inside the function after the call
to 'local' are restored to their original values when the function
returns. The restore is effected as if a series of 'set' commands
were executed to restore the values that were in place before the
function. The return status is zero unless 'local' is used outside
a function, an invalid NAME is supplied, or NAME is a readonly
variable.
'logout'
logout [N]
@@ -6608,30 +6609,36 @@ File: bash.info, Node: Aliases, Next: Arrays, Prev: Shell Arithmetic, Up: Ba
6.6 Aliases
===========
"Aliases" allow a string to be substituted for a word when it is used as
the first word of a simple command. The shell maintains a list of
aliases that may be set and unset with the 'alias' and 'unalias' builtin
commands.
"Aliases" allow a string to be substituted for a word that is in a
position in the input where it can be the first word of a simple
command. Aliases have names and corresponding values that are set and
unset using the 'alias' and 'unalias' builtin commands (*note Shell
Builtin Commands::).
The first word of each simple command, if unquoted, is checked to see
if it has an alias. If so, that word is replaced by the text of the
alias. The characters '/', '$', '`', '=' and any of the shell
metacharacters or quoting characters listed above may not appear in an
alias name. The replacement text may contain any valid shell input,
including shell metacharacters. The first word of the replacement text
is tested for aliases, but a word that is identical to an alias being
expanded is not expanded a second time. This means that one may alias
'ls' to '"ls -F"', for instance, and Bash does not try to recursively
expand the replacement text. If the last character of the alias value
is a 'blank', then the next command word following the alias is also
checked for alias expansion.
If the shell reads an unquoted word in the right position, it checks
the word to see if it matches an alias name. If it matches, the shell
replaces the word with the alias value, and reads that value as if it
had been read instead of the word. The shell doesn't look at any
characters following the word before attempting alias substitution.
The characters '/', '$', '`', '=' and any of the shell metacharacters
or quoting characters listed above may not appear in an alias name. The
replacement text may contain any valid shell input, including shell
metacharacters. The first word of the replacement text is tested for
aliases, but a word that is identical to an alias being expanded is not
expanded a second time. This means that one may alias 'ls' to '"ls
-F"', for instance, and Bash does not try to recursively expand the
replacement text.
If the last character of the alias value is a 'blank', then the next
command word following the alias is also checked for alias expansion.
Aliases are created and listed with the 'alias' command, and removed
with the 'unalias' command.
There is no mechanism for using arguments in the replacement text, as
in 'csh'. If arguments are needed, use a shell function (*note Shell
Functions::).
Functions::) instead.
Aliases are not expanded when the shell is not interactive, unless
the 'expand_aliases' shell option is set using 'shopt' (*note The Shopt
@@ -8398,6 +8405,11 @@ Variable Settings
undo lists across calls to 'readline()'. The default is
'off'.
'search-ignore-case'
If set to 'on', Readline performs incremental and
non-incremental history list searches in a case-insensitive
fashion. The default value is 'off'.
'show-all-if-ambiguous'
This alters the default behavior of the completion functions.
If set to 'on', words which have more than one possible
@@ -11890,17 +11902,17 @@ D.1 Index of Shell Builtin Commands
(line 58)
* let: Bash Builtins. (line 361)
* local: Bash Builtins. (line 369)
* logout: Bash Builtins. (line 385)
* mapfile: Bash Builtins. (line 390)
* logout: Bash Builtins. (line 386)
* mapfile: Bash Builtins. (line 391)
* popd: Directory Stack Builtins.
(line 35)
* printf: Bash Builtins. (line 436)
* printf: Bash Builtins. (line 437)
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 212)
* read: Bash Builtins. (line 503)
* readarray: Bash Builtins. (line 600)
* read: Bash Builtins. (line 504)
* readarray: Bash Builtins. (line 601)
* readonly: Bourne Shell Builtins.
(line 222)
* return: Bourne Shell Builtins.
@@ -11909,7 +11921,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 262)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 609)
* source: Bash Builtins. (line 610)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
@@ -11918,12 +11930,12 @@ D.1 Index of Shell Builtin Commands
(line 360)
* trap: Bourne Shell Builtins.
(line 366)
* type: Bash Builtins. (line 614)
* typeset: Bash Builtins. (line 652)
* ulimit: Bash Builtins. (line 658)
* type: Bash Builtins. (line 615)
* typeset: Bash Builtins. (line 653)
* ulimit: Bash Builtins. (line 659)
* umask: Bourne Shell Builtins.
(line 428)
* unalias: Bash Builtins. (line 764)
* unalias: Bash Builtins. (line 765)
* unset: Bourne Shell Builtins.
(line 446)
* wait: Job Control Builtins.
@@ -12184,18 +12196,20 @@ D.3 Parameter and Variable Index
* REPLY: Bash Variables. (line 630)
* revert-all-at-newline: Readline Init File Syntax.
(line 322)
* search-ignore-case: Readline Init File Syntax.
(line 329)
* SECONDS: Bash Variables. (line 633)
* SHELL: Bash Variables. (line 642)
* SHELLOPTS: Bash Variables. (line 647)
* SHLVL: Bash Variables. (line 656)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 329)
(line 334)
* show-all-if-unmodified: Readline Init File Syntax.
(line 335)
(line 340)
* show-mode-in-prompt: Readline Init File Syntax.
(line 344)
(line 349)
* skip-completed-text: Readline Init File Syntax.
(line 350)
(line 355)
* SRANDOM: Bash Variables. (line 661)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
@@ -12206,11 +12220,11 @@ D.3 Parameter and Variable Index
* TMPDIR: Bash Variables. (line 720)
* UID: Bash Variables. (line 724)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 363)
(line 368)
* vi-ins-mode-string: Readline Init File Syntax.
(line 374)
(line 379)
* visible-stats: Readline Init File Syntax.
(line 385)
(line 390)

File: bash.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
@@ -12589,138 +12603,138 @@ D.5 Concept Index

Tag Table:
Node: Top892
Node: Introduction2807
Node: What is Bash?3020
Node: What is a shell?4131
Node: Definitions6666
Node: Basic Shell Features9614
Node: Shell Syntax10830
Node: Shell Operation11853
Node: Quoting13143
Node: Escape Character14444
Node: Single Quotes14926
Node: Double Quotes15271
Node: ANSI-C Quoting16546
Node: Locale Translation17853
Node: Creating Internationalized Scripts19161
Node: Comments23275
Node: Shell Commands23890
Node: Reserved Words24825
Node: Simple Commands25578
Node: Pipelines26229
Node: Lists29225
Node: Compound Commands31017
Node: Looping Constructs32026
Node: Conditional Constructs34518
Node: Command Grouping49003
Node: Coprocesses50478
Node: GNU Parallel53138
Node: Shell Functions54052
Node: Shell Parameters61934
Node: Positional Parameters66319
Node: Special Parameters67218
Node: Shell Expansions70429
Node: Brace Expansion72553
Node: Tilde Expansion75284
Node: Shell Parameter Expansion77902
Node: Command Substitution96301
Node: Arithmetic Expansion97653
Node: Process Substitution98618
Node: Word Splitting99735
Node: Filename Expansion101676
Node: Pattern Matching104422
Node: Quote Removal109421
Node: Redirections109713
Node: Executing Commands119370
Node: Simple Command Expansion120037
Node: Command Search and Execution122144
Node: Command Execution Environment124528
Node: Environment127560
Node: Exit Status129220
Node: Signals131001
Node: Shell Scripts134447
Node: Shell Builtin Commands137471
Node: Bourne Shell Builtins139506
Node: Bash Builtins161701
Node: Modifying Shell Behavior193666
Node: The Set Builtin194008
Node: The Shopt Builtin204603
Node: Special Builtins220512
Node: Shell Variables221488
Node: Bourne Shell Variables221922
Node: Bash Variables224023
Node: Bash Features256835
Node: Invoking Bash257845
Node: Bash Startup Files263855
Node: Interactive Shells268983
Node: What is an Interactive Shell?269391
Node: Is this Shell Interactive?270037
Node: Interactive Shell Behavior270849
Node: Bash Conditional Expressions274475
Node: Shell Arithmetic279114
Node: Aliases282055
Node: Arrays284665
Node: The Directory Stack291053
Node: Directory Stack Builtins291834
Node: Controlling the Prompt296091
Node: The Restricted Shell299053
Node: Bash POSIX Mode301660
Node: Shell Compatibility Mode314523
Node: Job Control323087
Node: Job Control Basics323544
Node: Job Control Builtins328543
Node: Job Control Variables334335
Node: Command Line Editing335488
Node: Introduction and Notation337156
Node: Readline Interaction338776
Node: Readline Bare Essentials339964
Node: Readline Movement Commands341750
Node: Readline Killing Commands342707
Node: Readline Arguments344625
Node: Searching345666
Node: Readline Init File347849
Node: Readline Init File Syntax349107
Node: Conditional Init Constructs372690
Node: Sample Init File376883
Node: Bindable Readline Commands380004
Node: Commands For Moving381205
Node: Commands For History383253
Node: Commands For Text388244
Node: Commands For Killing391890
Node: Numeric Arguments394920
Node: Commands For Completion396056
Node: Keyboard Macros400244
Node: Miscellaneous Commands400929
Node: Readline vi Mode406871
Node: Programmable Completion407775
Node: Programmable Completion Builtins415552
Node: A Programmable Completion Example426301
Node: Using History Interactively431546
Node: Bash History Facilities432227
Node: Bash History Builtins435229
Node: History Interaction440250
Node: Event Designators443867
Node: Word Designators445218
Node: Modifiers446975
Node: Installing Bash448780
Node: Basic Installation449914
Node: Compilers and Options453633
Node: Compiling For Multiple Architectures454371
Node: Installation Names456060
Node: Specifying the System Type458166
Node: Sharing Defaults458880
Node: Operation Controls459550
Node: Optional Features460505
Node: Reporting Bugs471721
Node: Major Differences From The Bourne Shell473062
Node: GNU Free Documentation License489908
Node: Indexes515082
Node: Builtin Index515533
Node: Reserved Word Index522357
Node: Variable Index524802
Node: Function Index541573
Node: Concept Index555354
Node: Top894
Node: Introduction2811
Node: What is Bash?3024
Node: What is a shell?4135
Node: Definitions6670
Node: Basic Shell Features9618
Node: Shell Syntax10834
Node: Shell Operation11857
Node: Quoting13147
Node: Escape Character14448
Node: Single Quotes14930
Node: Double Quotes15275
Node: ANSI-C Quoting16550
Node: Locale Translation17857
Node: Creating Internationalized Scripts19165
Node: Comments23279
Node: Shell Commands23894
Node: Reserved Words24829
Node: Simple Commands25582
Node: Pipelines26233
Node: Lists29229
Node: Compound Commands31021
Node: Looping Constructs32030
Node: Conditional Constructs34522
Node: Command Grouping49007
Node: Coprocesses50482
Node: GNU Parallel53142
Node: Shell Functions54056
Node: Shell Parameters61938
Node: Positional Parameters66323
Node: Special Parameters67222
Node: Shell Expansions70433
Node: Brace Expansion72557
Node: Tilde Expansion75288
Node: Shell Parameter Expansion77906
Node: Command Substitution96305
Node: Arithmetic Expansion97657
Node: Process Substitution98622
Node: Word Splitting99739
Node: Filename Expansion101680
Node: Pattern Matching104426
Node: Quote Removal109425
Node: Redirections109717
Node: Executing Commands119374
Node: Simple Command Expansion120041
Node: Command Search and Execution122148
Node: Command Execution Environment124532
Node: Environment127564
Node: Exit Status129224
Node: Signals131005
Node: Shell Scripts134451
Node: Shell Builtin Commands137475
Node: Bourne Shell Builtins139510
Node: Bash Builtins161705
Node: Modifying Shell Behavior193701
Node: The Set Builtin194043
Node: The Shopt Builtin204638
Node: Special Builtins220547
Node: Shell Variables221523
Node: Bourne Shell Variables221957
Node: Bash Variables224058
Node: Bash Features256870
Node: Invoking Bash257880
Node: Bash Startup Files263890
Node: Interactive Shells269018
Node: What is an Interactive Shell?269426
Node: Is this Shell Interactive?270072
Node: Interactive Shell Behavior270884
Node: Bash Conditional Expressions274510
Node: Shell Arithmetic279149
Node: Aliases282090
Node: Arrays284981
Node: The Directory Stack291369
Node: Directory Stack Builtins292150
Node: Controlling the Prompt296407
Node: The Restricted Shell299369
Node: Bash POSIX Mode301976
Node: Shell Compatibility Mode314839
Node: Job Control323403
Node: Job Control Basics323860
Node: Job Control Builtins328859
Node: Job Control Variables334651
Node: Command Line Editing335804
Node: Introduction and Notation337472
Node: Readline Interaction339092
Node: Readline Bare Essentials340280
Node: Readline Movement Commands342066
Node: Readline Killing Commands343023
Node: Readline Arguments344941
Node: Searching345982
Node: Readline Init File348165
Node: Readline Init File Syntax349423
Node: Conditional Init Constructs373211
Node: Sample Init File377404
Node: Bindable Readline Commands380525
Node: Commands For Moving381726
Node: Commands For History383774
Node: Commands For Text388765
Node: Commands For Killing392411
Node: Numeric Arguments395441
Node: Commands For Completion396577
Node: Keyboard Macros400765
Node: Miscellaneous Commands401450
Node: Readline vi Mode407392
Node: Programmable Completion408296
Node: Programmable Completion Builtins416073
Node: A Programmable Completion Example426822
Node: Using History Interactively432067
Node: Bash History Facilities432748
Node: Bash History Builtins435750
Node: History Interaction440771
Node: Event Designators444388
Node: Word Designators445739
Node: Modifiers447496
Node: Installing Bash449301
Node: Basic Installation450435
Node: Compilers and Options454154
Node: Compiling For Multiple Architectures454892
Node: Installation Names456581
Node: Specifying the System Type458687
Node: Sharing Defaults459401
Node: Operation Controls460071
Node: Optional Features461026
Node: Reporting Bugs472242
Node: Major Differences From The Bourne Shell473583
Node: GNU Free Documentation License490429
Node: Indexes515603
Node: Builtin Index516054
Node: Reserved Word Index522878
Node: Variable Index525323
Node: Function Index542235
Node: Concept Index556016

End Tag Table
+190 -176
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 7 February 2023).
Bash shell (version 5.2, 20 February 2023).
This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 7 February 2023). The Bash home page is
Bash shell (version 5.2, 20 February 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash
This is Edition 5.2, last updated 20 February 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Bash contains features that appear in other popular shells, and some
@@ -4039,12 +4039,13 @@ standard.
the variable NAME have a visible scope restricted to that function
and its children. If NAME is '-', the set of shell options is made
local to the function in which 'local' is invoked: shell options
changed using the 'set' builtin inside the function are restored to
their original values when the function returns. The restore is
effected as if a series of 'set' commands were executed to restore
the values that were in place before the function. The return
status is zero unless 'local' is used outside a function, an
invalid NAME is supplied, or NAME is a readonly variable.
changed using the 'set' builtin inside the function after the call
to 'local' are restored to their original values when the function
returns. The restore is effected as if a series of 'set' commands
were executed to restore the values that were in place before the
function. The return status is zero unless 'local' is used outside
a function, an invalid NAME is supplied, or NAME is a readonly
variable.
'logout'
logout [N]
@@ -6609,30 +6610,36 @@ File: bashref.info, Node: Aliases, Next: Arrays, Prev: Shell Arithmetic, Up:
6.6 Aliases
===========
"Aliases" allow a string to be substituted for a word when it is used as
the first word of a simple command. The shell maintains a list of
aliases that may be set and unset with the 'alias' and 'unalias' builtin
commands.
"Aliases" allow a string to be substituted for a word that is in a
position in the input where it can be the first word of a simple
command. Aliases have names and corresponding values that are set and
unset using the 'alias' and 'unalias' builtin commands (*note Shell
Builtin Commands::).
The first word of each simple command, if unquoted, is checked to see
if it has an alias. If so, that word is replaced by the text of the
alias. The characters '/', '$', '`', '=' and any of the shell
metacharacters or quoting characters listed above may not appear in an
alias name. The replacement text may contain any valid shell input,
including shell metacharacters. The first word of the replacement text
is tested for aliases, but a word that is identical to an alias being
expanded is not expanded a second time. This means that one may alias
'ls' to '"ls -F"', for instance, and Bash does not try to recursively
expand the replacement text. If the last character of the alias value
is a 'blank', then the next command word following the alias is also
checked for alias expansion.
If the shell reads an unquoted word in the right position, it checks
the word to see if it matches an alias name. If it matches, the shell
replaces the word with the alias value, and reads that value as if it
had been read instead of the word. The shell doesn't look at any
characters following the word before attempting alias substitution.
The characters '/', '$', '`', '=' and any of the shell metacharacters
or quoting characters listed above may not appear in an alias name. The
replacement text may contain any valid shell input, including shell
metacharacters. The first word of the replacement text is tested for
aliases, but a word that is identical to an alias being expanded is not
expanded a second time. This means that one may alias 'ls' to '"ls
-F"', for instance, and Bash does not try to recursively expand the
replacement text.
If the last character of the alias value is a 'blank', then the next
command word following the alias is also checked for alias expansion.
Aliases are created and listed with the 'alias' command, and removed
with the 'unalias' command.
There is no mechanism for using arguments in the replacement text, as
in 'csh'. If arguments are needed, use a shell function (*note Shell
Functions::).
Functions::) instead.
Aliases are not expanded when the shell is not interactive, unless
the 'expand_aliases' shell option is set using 'shopt' (*note The Shopt
@@ -8399,6 +8406,11 @@ Variable Settings
undo lists across calls to 'readline()'. The default is
'off'.
'search-ignore-case'
If set to 'on', Readline performs incremental and
non-incremental history list searches in a case-insensitive
fashion. The default value is 'off'.
'show-all-if-ambiguous'
This alters the default behavior of the completion functions.
If set to 'on', words which have more than one possible
@@ -11891,17 +11903,17 @@ D.1 Index of Shell Builtin Commands
(line 58)
* let: Bash Builtins. (line 361)
* local: Bash Builtins. (line 369)
* logout: Bash Builtins. (line 385)
* mapfile: Bash Builtins. (line 390)
* logout: Bash Builtins. (line 386)
* mapfile: Bash Builtins. (line 391)
* popd: Directory Stack Builtins.
(line 35)
* printf: Bash Builtins. (line 436)
* printf: Bash Builtins. (line 437)
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 212)
* read: Bash Builtins. (line 503)
* readarray: Bash Builtins. (line 600)
* read: Bash Builtins. (line 504)
* readarray: Bash Builtins. (line 601)
* readonly: Bourne Shell Builtins.
(line 222)
* return: Bourne Shell Builtins.
@@ -11910,7 +11922,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 262)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 609)
* source: Bash Builtins. (line 610)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
@@ -11919,12 +11931,12 @@ D.1 Index of Shell Builtin Commands
(line 360)
* trap: Bourne Shell Builtins.
(line 366)
* type: Bash Builtins. (line 614)
* typeset: Bash Builtins. (line 652)
* ulimit: Bash Builtins. (line 658)
* type: Bash Builtins. (line 615)
* typeset: Bash Builtins. (line 653)
* ulimit: Bash Builtins. (line 659)
* umask: Bourne Shell Builtins.
(line 428)
* unalias: Bash Builtins. (line 764)
* unalias: Bash Builtins. (line 765)
* unset: Bourne Shell Builtins.
(line 446)
* wait: Job Control Builtins.
@@ -12185,18 +12197,20 @@ D.3 Parameter and Variable Index
* REPLY: Bash Variables. (line 630)
* revert-all-at-newline: Readline Init File Syntax.
(line 322)
* search-ignore-case: Readline Init File Syntax.
(line 329)
* SECONDS: Bash Variables. (line 633)
* SHELL: Bash Variables. (line 642)
* SHELLOPTS: Bash Variables. (line 647)
* SHLVL: Bash Variables. (line 656)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 329)
(line 334)
* show-all-if-unmodified: Readline Init File Syntax.
(line 335)
(line 340)
* show-mode-in-prompt: Readline Init File Syntax.
(line 344)
(line 349)
* skip-completed-text: Readline Init File Syntax.
(line 350)
(line 355)
* SRANDOM: Bash Variables. (line 661)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
@@ -12207,11 +12221,11 @@ D.3 Parameter and Variable Index
* TMPDIR: Bash Variables. (line 720)
* UID: Bash Variables. (line 724)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 363)
(line 368)
* vi-ins-mode-string: Readline Init File Syntax.
(line 374)
(line 379)
* visible-stats: Readline Init File Syntax.
(line 385)
(line 390)

File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
@@ -12590,138 +12604,138 @@ D.5 Concept Index

Tag Table:
Node: Top895
Node: Introduction2813
Node: What is Bash?3029
Node: What is a shell?4143
Node: Definitions6681
Node: Basic Shell Features9632
Node: Shell Syntax10851
Node: Shell Operation11877
Node: Quoting13170
Node: Escape Character14474
Node: Single Quotes14959
Node: Double Quotes15307
Node: ANSI-C Quoting16585
Node: Locale Translation17895
Node: Creating Internationalized Scripts19206
Node: Comments23323
Node: Shell Commands23941
Node: Reserved Words24879
Node: Simple Commands25635
Node: Pipelines26289
Node: Lists29288
Node: Compound Commands31083
Node: Looping Constructs32095
Node: Conditional Constructs34590
Node: Command Grouping49078
Node: Coprocesses50556
Node: GNU Parallel53219
Node: Shell Functions54136
Node: Shell Parameters62021
Node: Positional Parameters66409
Node: Special Parameters67311
Node: Shell Expansions70525
Node: Brace Expansion72652
Node: Tilde Expansion75386
Node: Shell Parameter Expansion78007
Node: Command Substitution96409
Node: Arithmetic Expansion97764
Node: Process Substitution98732
Node: Word Splitting99852
Node: Filename Expansion101796
Node: Pattern Matching104545
Node: Quote Removal109547
Node: Redirections109842
Node: Executing Commands119502
Node: Simple Command Expansion120172
Node: Command Search and Execution122282
Node: Command Execution Environment124669
Node: Environment127704
Node: Exit Status129367
Node: Signals131151
Node: Shell Scripts134600
Node: Shell Builtin Commands137627
Node: Bourne Shell Builtins139665
Node: Bash Builtins161863
Node: Modifying Shell Behavior193831
Node: The Set Builtin194176
Node: The Shopt Builtin204774
Node: Special Builtins220686
Node: Shell Variables221665
Node: Bourne Shell Variables222102
Node: Bash Variables224206
Node: Bash Features257021
Node: Invoking Bash258034
Node: Bash Startup Files264047
Node: Interactive Shells269178
Node: What is an Interactive Shell?269589
Node: Is this Shell Interactive?270238
Node: Interactive Shell Behavior271053
Node: Bash Conditional Expressions274682
Node: Shell Arithmetic279324
Node: Aliases282268
Node: Arrays284881
Node: The Directory Stack291272
Node: Directory Stack Builtins292056
Node: Controlling the Prompt296316
Node: The Restricted Shell299281
Node: Bash POSIX Mode301891
Node: Shell Compatibility Mode314757
Node: Job Control323324
Node: Job Control Basics323784
Node: Job Control Builtins328786
Node: Job Control Variables334581
Node: Command Line Editing335737
Node: Introduction and Notation337408
Node: Readline Interaction339031
Node: Readline Bare Essentials340222
Node: Readline Movement Commands342011
Node: Readline Killing Commands342971
Node: Readline Arguments344892
Node: Searching345936
Node: Readline Init File348122
Node: Readline Init File Syntax349383
Node: Conditional Init Constructs372969
Node: Sample Init File377165
Node: Bindable Readline Commands380289
Node: Commands For Moving381493
Node: Commands For History383544
Node: Commands For Text388538
Node: Commands For Killing392187
Node: Numeric Arguments395220
Node: Commands For Completion396359
Node: Keyboard Macros400550
Node: Miscellaneous Commands401238
Node: Readline vi Mode407183
Node: Programmable Completion408090
Node: Programmable Completion Builtins415870
Node: A Programmable Completion Example426622
Node: Using History Interactively431870
Node: Bash History Facilities432554
Node: Bash History Builtins435559
Node: History Interaction440583
Node: Event Designators444203
Node: Word Designators445557
Node: Modifiers447317
Node: Installing Bash449125
Node: Basic Installation450262
Node: Compilers and Options453984
Node: Compiling For Multiple Architectures454725
Node: Installation Names456417
Node: Specifying the System Type458526
Node: Sharing Defaults459243
Node: Operation Controls459916
Node: Optional Features460874
Node: Reporting Bugs472093
Node: Major Differences From The Bourne Shell473437
Node: GNU Free Documentation License490286
Node: Indexes515463
Node: Builtin Index515917
Node: Reserved Word Index522744
Node: Variable Index525192
Node: Function Index541966
Node: Concept Index555750
Node: Top897
Node: Introduction2817
Node: What is Bash?3033
Node: What is a shell?4147
Node: Definitions6685
Node: Basic Shell Features9636
Node: Shell Syntax10855
Node: Shell Operation11881
Node: Quoting13174
Node: Escape Character14478
Node: Single Quotes14963
Node: Double Quotes15311
Node: ANSI-C Quoting16589
Node: Locale Translation17899
Node: Creating Internationalized Scripts19210
Node: Comments23327
Node: Shell Commands23945
Node: Reserved Words24883
Node: Simple Commands25639
Node: Pipelines26293
Node: Lists29292
Node: Compound Commands31087
Node: Looping Constructs32099
Node: Conditional Constructs34594
Node: Command Grouping49082
Node: Coprocesses50560
Node: GNU Parallel53223
Node: Shell Functions54140
Node: Shell Parameters62025
Node: Positional Parameters66413
Node: Special Parameters67315
Node: Shell Expansions70529
Node: Brace Expansion72656
Node: Tilde Expansion75390
Node: Shell Parameter Expansion78011
Node: Command Substitution96413
Node: Arithmetic Expansion97768
Node: Process Substitution98736
Node: Word Splitting99856
Node: Filename Expansion101800
Node: Pattern Matching104549
Node: Quote Removal109551
Node: Redirections109846
Node: Executing Commands119506
Node: Simple Command Expansion120176
Node: Command Search and Execution122286
Node: Command Execution Environment124673
Node: Environment127708
Node: Exit Status129371
Node: Signals131155
Node: Shell Scripts134604
Node: Shell Builtin Commands137631
Node: Bourne Shell Builtins139669
Node: Bash Builtins161867
Node: Modifying Shell Behavior193866
Node: The Set Builtin194211
Node: The Shopt Builtin204809
Node: Special Builtins220721
Node: Shell Variables221700
Node: Bourne Shell Variables222137
Node: Bash Variables224241
Node: Bash Features257056
Node: Invoking Bash258069
Node: Bash Startup Files264082
Node: Interactive Shells269213
Node: What is an Interactive Shell?269624
Node: Is this Shell Interactive?270273
Node: Interactive Shell Behavior271088
Node: Bash Conditional Expressions274717
Node: Shell Arithmetic279359
Node: Aliases282303
Node: Arrays285197
Node: The Directory Stack291588
Node: Directory Stack Builtins292372
Node: Controlling the Prompt296632
Node: The Restricted Shell299597
Node: Bash POSIX Mode302207
Node: Shell Compatibility Mode315073
Node: Job Control323640
Node: Job Control Basics324100
Node: Job Control Builtins329102
Node: Job Control Variables334897
Node: Command Line Editing336053
Node: Introduction and Notation337724
Node: Readline Interaction339347
Node: Readline Bare Essentials340538
Node: Readline Movement Commands342327
Node: Readline Killing Commands343287
Node: Readline Arguments345208
Node: Searching346252
Node: Readline Init File348438
Node: Readline Init File Syntax349699
Node: Conditional Init Constructs373490
Node: Sample Init File377686
Node: Bindable Readline Commands380810
Node: Commands For Moving382014
Node: Commands For History384065
Node: Commands For Text389059
Node: Commands For Killing392708
Node: Numeric Arguments395741
Node: Commands For Completion396880
Node: Keyboard Macros401071
Node: Miscellaneous Commands401759
Node: Readline vi Mode407704
Node: Programmable Completion408611
Node: Programmable Completion Builtins416391
Node: A Programmable Completion Example427143
Node: Using History Interactively432391
Node: Bash History Facilities433075
Node: Bash History Builtins436080
Node: History Interaction441104
Node: Event Designators444724
Node: Word Designators446078
Node: Modifiers447838
Node: Installing Bash449646
Node: Basic Installation450783
Node: Compilers and Options454505
Node: Compiling For Multiple Architectures455246
Node: Installation Names456938
Node: Specifying the System Type459047
Node: Sharing Defaults459764
Node: Operation Controls460437
Node: Optional Features461395
Node: Reporting Bugs472614
Node: Major Differences From The Bourne Shell473958
Node: GNU Free Documentation License490807
Node: Indexes515984
Node: Builtin Index516438
Node: Reserved Word Index523265
Node: Variable Index525713
Node: Function Index542628
Node: Concept Index556412

End Tag Table
+19 -9
View File
@@ -2733,9 +2733,10 @@ word splitting.
The shell treats each character of @env{$IFS} as a delimiter, and splits
the results of the other expansions into words using these characters
as field terminators.
If @env{IFS} is unset, or its value is exactly @code{<space><tab><newline>},
the default, then sequences of
@code{ <space>}, @code{<tab>}, and @code{<newline>}
@code{space}, @code{tab}, and @code{newline}
at the beginning and end of the results of the previous
expansions are ignored, and any sequence of @env{IFS}
characters not at the beginning or end serves to delimit words.
@@ -2748,7 +2749,10 @@ Any character in @env{IFS} that is not @env{IFS}
whitespace, along with any adjacent @env{IFS}
whitespace characters, delimits a field. A sequence of @env{IFS}
whitespace characters is also treated as a delimiter.
If the value of @env{IFS} is null, no word splitting occurs.
If @env{IFS} is unset, word splitting behaves as if it contained
the default value @code{<space><tab><newline>}.
Explicit null arguments (@code{""} or @code{''}) are retained
and passed to commands as empty strings.
@@ -7614,14 +7618,19 @@ rules above.
@section Aliases
@cindex alias expansion
@dfn{Aliases} allow a string to be substituted for a word when it is used
as the first word of a simple command.
The shell maintains a list of aliases that may be set and unset with
the @code{alias} and @code{unalias} builtin commands.
@dfn{Aliases} allow a string to be substituted for a word that is in
a position in the input where it can be the first word of a simple
command. Aliases have names and corresponding values that are set
and unset using the @code{alias} and @code{unalias} builtin commands
(@pxref{Shell Builtin Commands}).
If the shell reads an unquoted word in the right position, it checks
the word to see if it matches an alias name. If it matches, the shell
replaces the word with the alias value, and reads that value as if it
had been read instead of the word.
The shell doesn't look at any characters following the word before
attempting alias substitution.
The first word of each simple command, if unquoted, is checked to see
if it has an alias.
If so, that word is replaced by the text of the alias.
The characters @samp{/}, @samp{$}, @samp{`}, @samp{=} and any of the
shell metacharacters or quoting characters listed above may not appear
in an alias name.
@@ -7633,6 +7642,7 @@ is not expanded a second time.
This means that one may alias @code{ls} to @code{"ls -F"},
for instance, and Bash does not try to recursively expand the
replacement text.
If the last character of the alias value is a
@code{blank}, then the next command word following the
alias is also checked for alias expansion.
@@ -7643,7 +7653,7 @@ command, and removed with the @code{unalias} command.
There is no mechanism for using arguments in the replacement text,
as in @code{csh}.
If arguments are needed, use a shell function
(@pxref{Shell Functions}).
(@pxref{Shell Functions}) instead.
Aliases are not expanded when the shell is not interactive,
unless the @code{expand_aliases} shell option is set using
+3 -2
View File
@@ -2,10 +2,11 @@
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Tue Feb 7 15:46:55 EST 2023
@set LASTCHANGE Mon Feb 20 09:59:31 EST 2023
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 7 February 2023
@set UPDATED 20 February 2023
@set UPDATED-MONTH February 2023
+9 -1
View File
@@ -2437,11 +2437,12 @@ shell_getc (int remove_quoted_newline)
if (c == EOF)
{
if (bash_input.type == st_stream)
if (interactive && bash_input.type == st_stream)
clearerr (stdin);
if (i == 0)
shell_input_line_terminator = EOF;
#if defined (BUFFERED_INPUT)
if (i == 0 && bash_input.type == st_bstream)
{
@@ -2450,7 +2451,14 @@ shell_getc (int remove_quoted_newline)
if (bp && berror (bp))
shell_input_line_terminator = READERR;
}
else
#endif
if (i == 0 && interactive_shell == 0 && bash_input.type == st_stream && ferror (stdin))
shell_input_line_terminator = READERR;
/* If we want to make read errors cancel execution of any partial
line, take out the checks for i == 0 above and set i = 0 if
shell_input_line_terminator == READERR. */
shell_input_line[i] = '\0';
break;
+1 -1
View File
@@ -189,7 +189,7 @@ int fail_glob_expansion;
/* If non-zero, perform `&' substitution on the replacement string in the
pattern substitution word expansion. */
int patsub_replacement = 1;
int patsub_replacement = PATSUB_REPLACE_DEFAULT;
/* Extern functions and variables from different files. */
extern struct fd_bitmap *current_fds_to_close;