new readline application hook to print macro key sequences and values; change bind -X default output format; bind -x accepts more input formats; quoting changes for pathname expansion patterns

This commit is contained in:
Chet Ramey
2023-08-01 09:59:09 -04:00
parent f6a78e24d8
commit ab99fdbca6
19 changed files with 2386 additions and 2209 deletions
+34 -16
View File
@@ -7185,22 +7185,6 @@ lib/readline/bind.c
can be reused as input.
Fixes bind -v issue reported by Sebastian Carlos <sebaaa1754@gmail.com>
7/19
----
lib/readline/bind.c
- _rl_macro_dumper_internal: if print_readably is < 0, don't
`untranslate' the macro value for an inputrc setting; leave it in
such a way that `bind' can use it. Print the value without the
enclosing double quotes.
From a report by Grisha Levit <grishalevit@gmail.com>
lib/readline/doc/rltech.texi
- rl_macro_dumper: document new semantics for print_readably
bashline.c
- print_unix_command_map: call rl_macro_dumper with an argument of -1
so we can use the output directly in another call to bind -x.
7/20
----
pathexp.c
@@ -7297,3 +7281,37 @@ builtins/printf.def
- printf_erange: make out-of-range errors conversion errors even if
the conversion function fully consumes the argument.
From a report by thomas@habets.se
7/31
----
lib/readline/rltypedefs.h
- rl_macro_print_func_t: typedef for a function to print macro key
bindings
lib/readline/bind.c
- rl_macro_display_hook: hook function to call if the application
wants to display a key sequence bound to a macro
- rl_macro_dumper: if rl_macro_display_hook is non-NULL, call it to
display the macro value (after `untranslating' it to add back any
required backslashes)
lib/readline/doc/rltech.texi
- rl_macro_display_hook: add description
pathexp.c
- glob_char_p: add the characters that are special within BRE bracket
expressions.
Inspired by a report by Grisha Levit <grishalevit@gmail.com>
bashline.c
- bind_keyseq_to_unix_command: allow whitespace to separate the keyseq
and the command string, but require the command string to be
surrounded by double quotes if it is. If we get a whitespace
separator, call rl_macro_bind so we get the string `translated'
according to how readline does it (backslash-escape sequences
processed, etc.)
- print_unix_command: function to print a key sequence and a unix
command bound to it from cmd_xmap, using a space separator
- print_unix_command_map: make sure to set rl_macro_display_hook to
print_unix_command before calling rl_macro_dumper to print the
bound command strings
+1
View File
@@ -1022,6 +1022,7 @@ tests/comsub22.sub f
tests/comsub23.sub f
tests/comsub24.sub f
tests/comsub25.sub f
tests/comsub26.sub f
tests/comsub-eof.tests f
tests/comsub-eof0.sub f
tests/comsub-eof1.sub f
+35 -8
View File
@@ -4580,15 +4580,29 @@ bash_execute_unix_command (int count, int key)
return 0;
}
/* This only has to handle macros/shell commandsfrom print_unix_command_map */
static void
print_unix_command (const char *kseq, const char *value, int readable, const char *prefix)
{
if (readable)
fprintf (rl_outstream, "\"%s%s\" \"%s\"\n", prefix ? prefix : "", kseq, value ? value : "");
else
fprintf (rl_outstream, "%s%s outputs %s\n", prefix ? prefix : "", kseq, value ? value : "");
}
int
print_unix_command_map (void)
{
Keymap save, cmd_xmap;
rl_macro_print_func_t *old_printer;
save = rl_get_keymap ();
cmd_xmap = get_cmd_xmap_from_keymap (save);
rl_set_keymap (cmd_xmap);
rl_macro_dumper (-1);
old_printer = rl_macro_display_hook;
rl_macro_display_hook = print_unix_command;
rl_macro_dumper (1);
rl_macro_display_hook = old_printer;
rl_set_keymap (save);
return 0;
}
@@ -4702,12 +4716,12 @@ bind_keyseq_to_unix_command (char *line)
{
Keymap kmap, cmd_xmap;
char *kseq, *value;
int i, kstart;
int i, kstart, translate;
kmap = rl_get_keymap ();
/* We duplicate some of the work done by rl_parse_and_bind here, but
this code only has to handle `"keyseq": ["]command["]' and can
this code only has to handle `"keyseq"[:][ \t]+["]command["]' and can
generate an error for anything else. */
i = isolate_sequence (line, 0, 1, &kstart);
if (i < 0)
@@ -4716,16 +4730,26 @@ bind_keyseq_to_unix_command (char *line)
/* Create the key sequence string to pass to rl_generic_bind */
kseq = substring (line, kstart, i);
for ( ; line[i] && line[i] != ':'; i++)
/* Allow colon or whitespace to separate the key sequence and command string. */
for ( ; line[i] && line[i] != ':' && whitespace (line[i]) == 0; i++)
;
if (line[i] != ':')
if (line[i] != ':' && whitespace (line[i]) == 0)
{
builtin_error (_("%s: missing colon separator"), line);
builtin_error (_("%s: missing separator"), line);
FREE (kseq);
return -1;
}
i = isolate_sequence (line, i + 1, 0, &kstart);
/* If we have a whitespace separator we're going to call rl_macro_bind so
we get the readline-translated version of the value (backslash-escapes
handled, etc.) */
translate = line[i] != ':';
/* Kind of tricky. If we use whitespace as a delimiter, we can backslash-
quote double quotes and have them preserved in the value. However, we
still want to be able to auto-detect quoted strings and only require
them with whitespace delimiters. */
i = isolate_sequence (line, i + 1, translate, &kstart);
if (i < 0)
{
FREE (kseq);
@@ -4737,7 +4761,10 @@ bind_keyseq_to_unix_command (char *line)
/* Save the command to execute and the key sequence in the CMD_XMAP */
cmd_xmap = get_cmd_xmap_from_keymap (kmap);
rl_generic_bind (ISMACR, kseq, value, cmd_xmap);
if (translate)
rl_macro_bind (kseq, value, cmd_xmap);
else
rl_generic_bind (ISMACR, kseq, value, cmd_xmap);
/* and bind the key sequence in the current keymap to a function that
understands how to execute from CMD_XMAP */
+1002 -993
View File
File diff suppressed because it is too large Load Diff
+14 -5
View File
@@ -5,14 +5,14 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Wed Jul 26 09:57:28 EDT 2023
.\" Last Change: Mon Jul 31 15:50:16 EDT 2023
.\"
.\" bash_builtins, strip all but Built-Ins section
.\" avoid a warning about an undefined register
.if !rzY .nr zY 0
.\" .if !rzY .nr zY 0
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2023 July 26" "GNU Bash 5.3"
.TH BASH 1 "2023 July 31" "GNU Bash 5.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -7918,7 +7918,7 @@ or was started without job control.
.TP
\fBbind\fP [\fB\-m\fP \fIkeymap\fP] \fB\-f\fP \fIfilename\fP
.TP
\fBbind\fP [\fB\-m\fP \fIkeymap\fP] \fB\-x\fP \fIkeyseq\fP:\fIshell\-command\fP
\fBbind\fP [\fB\-m\fP \fIkeymap\fP] \fB\-x\fP \fIkeyseq\fP[:] \fIshell\-command\fP
.TP
\fBbind\fP [\fB\-m\fP \fIkeymap\fP] \fIkeyseq\fP:\fIfunction\-name\fP
.TP
@@ -7994,9 +7994,18 @@ Unbind all keys bound to the named \fIfunction\fP.
.B \-r \fIkeyseq\fP
Remove any current binding for \fIkeyseq\fP.
.TP
.B \-x \fIkeyseq\fP:\fIshell\-command\fP
.B \-x \fIkeyseq\fP[: ]\fIshell\-command\fP
Cause \fIshell\-command\fP to be executed whenever \fIkeyseq\fP is
entered.
The separator between \fIkeyseq\fP and \fIshell\-command\fP is either
whitespace or a colon optionally followed by whitespace.
If the separator is whitespace, \fIshell\-command\fP
must be enclosed in double quotes and \fBreadline\fP expands any of its
special backslash-escapes in \fIshell\-command\fP before saving it.
If the separator is a colon, any enclosing double quotes are optional, and
\fBreadline\fP does not expand the command string before saving it.
Since the entire key binding expression must be a single argument, it
should be enclosed in quotes.
When \fIshell\-command\fP is executed, the shell sets the
.SM
.B READLINE_LINE
+111 -102
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.3, 26 July 2023).
Bash shell (version 5.3, 31 July 2023).
This is Edition 5.3, last updated 26 July 2023, of 'The GNU Bash
This is Edition 5.3, last updated 31 July 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
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.3, 26 July 2023). The Bash home page is
Bash shell (version 5.3, 31 July 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 26 July 2023, of 'The GNU Bash
This is Edition 5.3, last updated 31 July 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -3774,7 +3774,7 @@ standard.
bind [-m KEYMAP] [-lpsvPSVX]
bind [-m KEYMAP] [-q FUNCTION] [-u FUNCTION] [-r KEYSEQ]
bind [-m KEYMAP] -f FILENAME
bind [-m KEYMAP] -x KEYSEQ:SHELL-COMMAND
bind [-m KEYMAP] -x KEYSEQ[: ]SHELL-COMMAND
bind [-m KEYMAP] KEYSEQ:FUNCTION-NAME
bind [-m KEYMAP] KEYSEQ:READLINE-COMMAND
bind READLINE-COMMAND-LINE
@@ -3838,6 +3838,15 @@ standard.
'-x KEYSEQ:SHELL-COMMAND'
Cause SHELL-COMMAND to be executed whenever KEYSEQ is entered.
The separator between KEYSEQ and SHELL-COMMAND is either
whitespace or a colon optionally followed by whitespace. If
the separator is whitespace, SHELL-COMMAND must be enclosed in
double quotes and Readline expands any of its special
backslash-escapes in SHELL-COMMAND before saving it. If the
separator is a colon, any enclosing double quotes are
optional, and Readline does not expand the command string
before saving it. Since the entire key binding expression
must be a single argument, it should be enclosed in quotes.
When SHELL-COMMAND is executed, the shell sets the
'READLINE_LINE' variable to the contents of the Readline line
buffer and the 'READLINE_POINT' and 'READLINE_MARK' variables
@@ -12077,11 +12086,11 @@ D.1 Index of Shell Builtin Commands
* bind: Bash Builtins. (line 21)
* break: Bourne Shell Builtins.
(line 37)
* builtin: Bash Builtins. (line 108)
* caller: Bash Builtins. (line 117)
* builtin: Bash Builtins. (line 117)
* caller: Bash Builtins. (line 126)
* cd: Bourne Shell Builtins.
(line 45)
* command: Bash Builtins. (line 134)
* command: Bash Builtins. (line 143)
* compgen: Programmable Completion Builtins.
(line 12)
* complete: Programmable Completion Builtins.
@@ -12090,13 +12099,13 @@ D.1 Index of Shell Builtin Commands
(line 248)
* continue: Bourne Shell Builtins.
(line 90)
* declare: Bash Builtins. (line 154)
* declare: Bash Builtins. (line 163)
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 104)
* echo: Bash Builtins. (line 257)
* enable: Bash Builtins. (line 306)
* echo: Bash Builtins. (line 266)
* enable: Bash Builtins. (line 315)
* eval: Bourne Shell Builtins.
(line 99)
* exec: Bourne Shell Builtins.
@@ -12115,26 +12124,26 @@ D.1 Index of Shell Builtin Commands
(line 153)
* hash: Bourne Shell Builtins.
(line 197)
* help: Bash Builtins. (line 342)
* help: Bash Builtins. (line 351)
* history: Bash History Builtins.
(line 46)
* jobs: Job Control Builtins.
(line 27)
* kill: Job Control Builtins.
(line 58)
* let: Bash Builtins. (line 361)
* local: Bash Builtins. (line 369)
* logout: Bash Builtins. (line 386)
* mapfile: Bash Builtins. (line 391)
* let: Bash Builtins. (line 370)
* local: Bash Builtins. (line 378)
* logout: Bash Builtins. (line 395)
* mapfile: Bash Builtins. (line 400)
* popd: Directory Stack Builtins.
(line 35)
* printf: Bash Builtins. (line 437)
* printf: Bash Builtins. (line 446)
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 218)
* read: Bash Builtins. (line 504)
* readarray: Bash Builtins. (line 601)
* read: Bash Builtins. (line 513)
* readarray: Bash Builtins. (line 610)
* readonly: Bourne Shell Builtins.
(line 228)
* return: Bourne Shell Builtins.
@@ -12143,7 +12152,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 268)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 610)
* source: Bash Builtins. (line 619)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
@@ -12154,12 +12163,12 @@ D.1 Index of Shell Builtin Commands
(line 389)
* true: Bourne Shell Builtins.
(line 451)
* type: Bash Builtins. (line 615)
* typeset: Bash Builtins. (line 653)
* ulimit: Bash Builtins. (line 659)
* type: Bash Builtins. (line 624)
* typeset: Bash Builtins. (line 662)
* ulimit: Bash Builtins. (line 668)
* umask: Bourne Shell Builtins.
(line 456)
* unalias: Bash Builtins. (line 765)
* unalias: Bash Builtins. (line 774)
* unset: Bourne Shell Builtins.
(line 474)
* wait: Job Control Builtins.
@@ -12889,84 +12898,84 @@ Node: Shell Scripts137006
Node: Shell Builtin Commands140030
Node: Bourne Shell Builtins142065
Node: Bash Builtins165198
Node: Modifying Shell Behavior197221
Node: The Set Builtin197563
Node: The Shopt Builtin208504
Node: Special Builtins224639
Node: Shell Variables225615
Node: Bourne Shell Variables226049
Node: Bash Variables228150
Node: Bash Features263104
Node: Invoking Bash264114
Node: Bash Startup Files270124
Node: Interactive Shells275252
Node: What is an Interactive Shell?275660
Node: Is this Shell Interactive?276306
Node: Interactive Shell Behavior277118
Node: Bash Conditional Expressions280744
Node: Shell Arithmetic285383
Node: Aliases288341
Node: Arrays291232
Node: The Directory Stack297792
Node: Directory Stack Builtins298573
Node: Controlling the Prompt302830
Node: The Restricted Shell305792
Node: Bash POSIX Mode308399
Node: Shell Compatibility Mode324539
Node: Job Control332780
Node: Job Control Basics333237
Node: Job Control Builtins338236
Node: Job Control Variables344028
Node: Command Line Editing345181
Node: Introduction and Notation346849
Node: Readline Interaction348469
Node: Readline Bare Essentials349657
Node: Readline Movement Commands351443
Node: Readline Killing Commands352400
Node: Readline Arguments354318
Node: Searching355359
Node: Readline Init File357542
Node: Readline Init File Syntax358800
Node: Conditional Init Constructs382822
Node: Sample Init File387015
Node: Bindable Readline Commands390136
Node: Commands For Moving391337
Node: Commands For History393385
Node: Commands For Text398376
Node: Commands For Killing402351
Node: Numeric Arguments405052
Node: Commands For Completion406188
Node: Keyboard Macros410376
Node: Miscellaneous Commands411061
Node: Readline vi Mode417096
Node: Programmable Completion418000
Node: Programmable Completion Builtins425777
Node: A Programmable Completion Example436894
Node: Using History Interactively442139
Node: Bash History Facilities442820
Node: Bash History Builtins445822
Node: History Interaction450843
Node: Event Designators454460
Node: Word Designators455811
Node: Modifiers457568
Node: Installing Bash459373
Node: Basic Installation460507
Node: Compilers and Options464226
Node: Compiling For Multiple Architectures464964
Node: Installation Names466653
Node: Specifying the System Type468759
Node: Sharing Defaults469473
Node: Operation Controls470143
Node: Optional Features471098
Node: Reporting Bugs482314
Node: Major Differences From The Bourne Shell483645
Node: GNU Free Documentation License500491
Node: Indexes525665
Node: Builtin Index526116
Node: Reserved Word Index533214
Node: Variable Index535659
Node: Function Index552790
Node: Concept Index566508
Node: Modifying Shell Behavior197841
Node: The Set Builtin198183
Node: The Shopt Builtin209124
Node: Special Builtins225259
Node: Shell Variables226235
Node: Bourne Shell Variables226669
Node: Bash Variables228770
Node: Bash Features263724
Node: Invoking Bash264734
Node: Bash Startup Files270744
Node: Interactive Shells275872
Node: What is an Interactive Shell?276280
Node: Is this Shell Interactive?276926
Node: Interactive Shell Behavior277738
Node: Bash Conditional Expressions281364
Node: Shell Arithmetic286003
Node: Aliases288961
Node: Arrays291852
Node: The Directory Stack298412
Node: Directory Stack Builtins299193
Node: Controlling the Prompt303450
Node: The Restricted Shell306412
Node: Bash POSIX Mode309019
Node: Shell Compatibility Mode325159
Node: Job Control333400
Node: Job Control Basics333857
Node: Job Control Builtins338856
Node: Job Control Variables344648
Node: Command Line Editing345801
Node: Introduction and Notation347469
Node: Readline Interaction349089
Node: Readline Bare Essentials350277
Node: Readline Movement Commands352063
Node: Readline Killing Commands353020
Node: Readline Arguments354938
Node: Searching355979
Node: Readline Init File358162
Node: Readline Init File Syntax359420
Node: Conditional Init Constructs383442
Node: Sample Init File387635
Node: Bindable Readline Commands390756
Node: Commands For Moving391957
Node: Commands For History394005
Node: Commands For Text398996
Node: Commands For Killing402971
Node: Numeric Arguments405672
Node: Commands For Completion406808
Node: Keyboard Macros410996
Node: Miscellaneous Commands411681
Node: Readline vi Mode417716
Node: Programmable Completion418620
Node: Programmable Completion Builtins426397
Node: A Programmable Completion Example437514
Node: Using History Interactively442759
Node: Bash History Facilities443440
Node: Bash History Builtins446442
Node: History Interaction451463
Node: Event Designators455080
Node: Word Designators456431
Node: Modifiers458188
Node: Installing Bash459993
Node: Basic Installation461127
Node: Compilers and Options464846
Node: Compiling For Multiple Architectures465584
Node: Installation Names467273
Node: Specifying the System Type469379
Node: Sharing Defaults470093
Node: Operation Controls470763
Node: Optional Features471718
Node: Reporting Bugs482934
Node: Major Differences From The Bourne Shell484265
Node: GNU Free Documentation License501111
Node: Indexes526285
Node: Builtin Index526736
Node: Reserved Word Index533834
Node: Variable Index536279
Node: Function Index553410
Node: Concept Index567128

End Tag Table
+111 -102
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.3, 26 July 2023).
Bash shell (version 5.3, 31 July 2023).
This is Edition 5.3, last updated 26 July 2023, of 'The GNU Bash
This is Edition 5.3, last updated 31 July 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
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.3, 26 July 2023). The Bash home page is
Bash shell (version 5.3, 31 July 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 26 July 2023, of 'The GNU Bash
This is Edition 5.3, last updated 31 July 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -3775,7 +3775,7 @@ standard.
bind [-m KEYMAP] [-lpsvPSVX]
bind [-m KEYMAP] [-q FUNCTION] [-u FUNCTION] [-r KEYSEQ]
bind [-m KEYMAP] -f FILENAME
bind [-m KEYMAP] -x KEYSEQ:SHELL-COMMAND
bind [-m KEYMAP] -x KEYSEQ[: ]SHELL-COMMAND
bind [-m KEYMAP] KEYSEQ:FUNCTION-NAME
bind [-m KEYMAP] KEYSEQ:READLINE-COMMAND
bind READLINE-COMMAND-LINE
@@ -3839,6 +3839,15 @@ standard.
'-x KEYSEQ:SHELL-COMMAND'
Cause SHELL-COMMAND to be executed whenever KEYSEQ is entered.
The separator between KEYSEQ and SHELL-COMMAND is either
whitespace or a colon optionally followed by whitespace. If
the separator is whitespace, SHELL-COMMAND must be enclosed in
double quotes and Readline expands any of its special
backslash-escapes in SHELL-COMMAND before saving it. If the
separator is a colon, any enclosing double quotes are
optional, and Readline does not expand the command string
before saving it. Since the entire key binding expression
must be a single argument, it should be enclosed in quotes.
When SHELL-COMMAND is executed, the shell sets the
'READLINE_LINE' variable to the contents of the Readline line
buffer and the 'READLINE_POINT' and 'READLINE_MARK' variables
@@ -12078,11 +12087,11 @@ D.1 Index of Shell Builtin Commands
* bind: Bash Builtins. (line 21)
* break: Bourne Shell Builtins.
(line 37)
* builtin: Bash Builtins. (line 108)
* caller: Bash Builtins. (line 117)
* builtin: Bash Builtins. (line 117)
* caller: Bash Builtins. (line 126)
* cd: Bourne Shell Builtins.
(line 45)
* command: Bash Builtins. (line 134)
* command: Bash Builtins. (line 143)
* compgen: Programmable Completion Builtins.
(line 12)
* complete: Programmable Completion Builtins.
@@ -12091,13 +12100,13 @@ D.1 Index of Shell Builtin Commands
(line 248)
* continue: Bourne Shell Builtins.
(line 90)
* declare: Bash Builtins. (line 154)
* declare: Bash Builtins. (line 163)
* dirs: Directory Stack Builtins.
(line 7)
* disown: Job Control Builtins.
(line 104)
* echo: Bash Builtins. (line 257)
* enable: Bash Builtins. (line 306)
* echo: Bash Builtins. (line 266)
* enable: Bash Builtins. (line 315)
* eval: Bourne Shell Builtins.
(line 99)
* exec: Bourne Shell Builtins.
@@ -12116,26 +12125,26 @@ D.1 Index of Shell Builtin Commands
(line 153)
* hash: Bourne Shell Builtins.
(line 197)
* help: Bash Builtins. (line 342)
* help: Bash Builtins. (line 351)
* history: Bash History Builtins.
(line 46)
* jobs: Job Control Builtins.
(line 27)
* kill: Job Control Builtins.
(line 58)
* let: Bash Builtins. (line 361)
* local: Bash Builtins. (line 369)
* logout: Bash Builtins. (line 386)
* mapfile: Bash Builtins. (line 391)
* let: Bash Builtins. (line 370)
* local: Bash Builtins. (line 378)
* logout: Bash Builtins. (line 395)
* mapfile: Bash Builtins. (line 400)
* popd: Directory Stack Builtins.
(line 35)
* printf: Bash Builtins. (line 437)
* printf: Bash Builtins. (line 446)
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 218)
* read: Bash Builtins. (line 504)
* readarray: Bash Builtins. (line 601)
* read: Bash Builtins. (line 513)
* readarray: Bash Builtins. (line 610)
* readonly: Bourne Shell Builtins.
(line 228)
* return: Bourne Shell Builtins.
@@ -12144,7 +12153,7 @@ D.1 Index of Shell Builtin Commands
* shift: Bourne Shell Builtins.
(line 268)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 610)
* source: Bash Builtins. (line 619)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
@@ -12155,12 +12164,12 @@ D.1 Index of Shell Builtin Commands
(line 389)
* true: Bourne Shell Builtins.
(line 451)
* type: Bash Builtins. (line 615)
* typeset: Bash Builtins. (line 653)
* ulimit: Bash Builtins. (line 659)
* type: Bash Builtins. (line 624)
* typeset: Bash Builtins. (line 662)
* ulimit: Bash Builtins. (line 668)
* umask: Bourne Shell Builtins.
(line 456)
* unalias: Bash Builtins. (line 765)
* unalias: Bash Builtins. (line 774)
* unset: Bourne Shell Builtins.
(line 474)
* wait: Job Control Builtins.
@@ -12890,84 +12899,84 @@ Node: Shell Scripts137159
Node: Shell Builtin Commands140186
Node: Bourne Shell Builtins142224
Node: Bash Builtins165360
Node: Modifying Shell Behavior197386
Node: The Set Builtin197731
Node: The Shopt Builtin208675
Node: Special Builtins224813
Node: Shell Variables225792
Node: Bourne Shell Variables226229
Node: Bash Variables228333
Node: Bash Features263290
Node: Invoking Bash264303
Node: Bash Startup Files270316
Node: Interactive Shells275447
Node: What is an Interactive Shell?275858
Node: Is this Shell Interactive?276507
Node: Interactive Shell Behavior277322
Node: Bash Conditional Expressions280951
Node: Shell Arithmetic285593
Node: Aliases288554
Node: Arrays291448
Node: The Directory Stack298011
Node: Directory Stack Builtins298795
Node: Controlling the Prompt303055
Node: The Restricted Shell306020
Node: Bash POSIX Mode308630
Node: Shell Compatibility Mode324773
Node: Job Control333017
Node: Job Control Basics333477
Node: Job Control Builtins338479
Node: Job Control Variables344274
Node: Command Line Editing345430
Node: Introduction and Notation347101
Node: Readline Interaction348724
Node: Readline Bare Essentials349915
Node: Readline Movement Commands351704
Node: Readline Killing Commands352664
Node: Readline Arguments354585
Node: Searching355629
Node: Readline Init File357815
Node: Readline Init File Syntax359076
Node: Conditional Init Constructs383101
Node: Sample Init File387297
Node: Bindable Readline Commands390421
Node: Commands For Moving391625
Node: Commands For History393676
Node: Commands For Text398670
Node: Commands For Killing402648
Node: Numeric Arguments405352
Node: Commands For Completion406491
Node: Keyboard Macros410682
Node: Miscellaneous Commands411370
Node: Readline vi Mode417408
Node: Programmable Completion418315
Node: Programmable Completion Builtins426095
Node: A Programmable Completion Example437215
Node: Using History Interactively442463
Node: Bash History Facilities443147
Node: Bash History Builtins446152
Node: History Interaction451176
Node: Event Designators454796
Node: Word Designators456150
Node: Modifiers457910
Node: Installing Bash459718
Node: Basic Installation460855
Node: Compilers and Options464577
Node: Compiling For Multiple Architectures465318
Node: Installation Names467010
Node: Specifying the System Type469119
Node: Sharing Defaults469836
Node: Operation Controls470509
Node: Optional Features471467
Node: Reporting Bugs482686
Node: Major Differences From The Bourne Shell484020
Node: GNU Free Documentation License500869
Node: Indexes526046
Node: Builtin Index526500
Node: Reserved Word Index533601
Node: Variable Index536049
Node: Function Index553183
Node: Concept Index566904
Node: Modifying Shell Behavior198006
Node: The Set Builtin198351
Node: The Shopt Builtin209295
Node: Special Builtins225433
Node: Shell Variables226412
Node: Bourne Shell Variables226849
Node: Bash Variables228953
Node: Bash Features263910
Node: Invoking Bash264923
Node: Bash Startup Files270936
Node: Interactive Shells276067
Node: What is an Interactive Shell?276478
Node: Is this Shell Interactive?277127
Node: Interactive Shell Behavior277942
Node: Bash Conditional Expressions281571
Node: Shell Arithmetic286213
Node: Aliases289174
Node: Arrays292068
Node: The Directory Stack298631
Node: Directory Stack Builtins299415
Node: Controlling the Prompt303675
Node: The Restricted Shell306640
Node: Bash POSIX Mode309250
Node: Shell Compatibility Mode325393
Node: Job Control333637
Node: Job Control Basics334097
Node: Job Control Builtins339099
Node: Job Control Variables344894
Node: Command Line Editing346050
Node: Introduction and Notation347721
Node: Readline Interaction349344
Node: Readline Bare Essentials350535
Node: Readline Movement Commands352324
Node: Readline Killing Commands353284
Node: Readline Arguments355205
Node: Searching356249
Node: Readline Init File358435
Node: Readline Init File Syntax359696
Node: Conditional Init Constructs383721
Node: Sample Init File387917
Node: Bindable Readline Commands391041
Node: Commands For Moving392245
Node: Commands For History394296
Node: Commands For Text399290
Node: Commands For Killing403268
Node: Numeric Arguments405972
Node: Commands For Completion407111
Node: Keyboard Macros411302
Node: Miscellaneous Commands411990
Node: Readline vi Mode418028
Node: Programmable Completion418935
Node: Programmable Completion Builtins426715
Node: A Programmable Completion Example437835
Node: Using History Interactively443083
Node: Bash History Facilities443767
Node: Bash History Builtins446772
Node: History Interaction451796
Node: Event Designators455416
Node: Word Designators456770
Node: Modifiers458530
Node: Installing Bash460338
Node: Basic Installation461475
Node: Compilers and Options465197
Node: Compiling For Multiple Architectures465938
Node: Installation Names467630
Node: Specifying the System Type469739
Node: Sharing Defaults470456
Node: Operation Controls471129
Node: Optional Features472087
Node: Reporting Bugs483306
Node: Major Differences From The Bourne Shell484640
Node: GNU Free Documentation License501489
Node: Indexes526666
Node: Builtin Index527120
Node: Reserved Word Index534221
Node: Variable Index536669
Node: Function Index553803
Node: Concept Index567524

End Tag Table
+10 -1
View File
@@ -4489,7 +4489,7 @@ Aliases are described in @ref{Aliases}.
bind [-m @var{keymap}] [-lpsvPSVX]
bind [-m @var{keymap}] [-q @var{function}] [-u @var{function}] [-r @var{keyseq}]
bind [-m @var{keymap}] -f @var{filename}
bind [-m @var{keymap}] -x @var{keyseq:shell-command}
bind [-m @var{keymap}] -x @var{keyseq[: ]shell-command}
bind [-m @var{keymap}] @var{keyseq:function-name}
bind [-m @var{keymap}] @var{keyseq:readline-command}
bind @var{readline-command-line}
@@ -4562,6 +4562,15 @@ Remove any current binding for @var{keyseq}.
@item -x @var{keyseq:shell-command}
Cause @var{shell-command} to be executed whenever @var{keyseq} is
entered.
The separator between @var{keyseq} and @var{shell-command} is either
whitespace or a colon optionally followed by whitespace.
If the separator is whitespace, @var{shell-command}
must be enclosed in double quotes and Readline expands any of its
special backslash-escapes in @var{shell-command} before saving it.
If the separator is a colon, any enclosing double quotes are optional, and
Readline does not expand the command string before saving it.
Since the entire key binding expression must be a single argument, it
should be enclosed in quotes.
When @var{shell-command} is executed, the shell sets the
@code{READLINE_LINE} variable to the contents of the Readline line
buffer and the @code{READLINE_POINT} and @code{READLINE_MARK} variables
+973 -964
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Wed Jul 26 09:57:28 EDT 2023
@set LASTCHANGE Mon Jul 31 15:55:56 EDT 2023
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 26 July 2023
@set UPDATED 31 July 2023
@set UPDATED-MONTH July 2023
+15 -9
View File
@@ -68,6 +68,9 @@ extern int errno;
/* Variables exported by this file. */
Keymap rl_binding_keymap;
/* Functions exported by this file. */
rl_macro_print_func_t *rl_macro_display_hook = (rl_macro_print_func_t *)NULL;
static int _rl_skip_to_delim (char *, int, int);
static void _rl_init_file_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
@@ -2861,16 +2864,19 @@ _rl_macro_dumper_internal (int print_readably, Keymap map, char *prefix)
{
case ISMACR:
keyname = _rl_get_keyname (key);
if (print_readably < 0)
out = savestring ((char *)map[key].function);
else
out = _rl_untranslate_macro_value ((char *)map[key].function, 0);
out = _rl_untranslate_macro_value ((char *)map[key].function, 0);
if (print_readably < 0)
fprintf (rl_outstream, "\"%s%s\": %s\n", prefix ? prefix : "",
keyname,
out ? out : "");
else if (print_readably > 0)
/* If the application wants to print macros, let it. Give it the
ascii-fied value with backslash escapes, so it will have to use
rl_macro_bind (with its call to rl_translate_keyseq) to get the
same value back. */
if (rl_macro_display_hook)
{
(*rl_macro_display_hook) (keyname, out, print_readably, prefix);
break;
}
if (print_readably)
fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
keyname,
out ? out : "");
+11 -4
View File
@@ -515,6 +515,15 @@ By default, this is set to @code{rl_deprep_terminal}
(@pxref{Terminal Management}).
@end deftypevar
@deftypevar {void} rl_macro_display_hook
If set, this points to a function that @code{rl_macro_dumper} will call to
display a key sequence bound to a macro.
It is called with the key sequence, the "untranslated" macro value (i.e.,
with backslash escapes included, as when passed to @code{rl_macro_bind}),
the @code{readable} argument passed to @code{rl_macro_dumper}, and any
prefix to display before the key sequence.
@end deftypevar
@deftypevar {Keymap} rl_executing_keymap
This variable is set to the keymap (@pxref{Keymaps}) in which the
currently executing Readline function was found.
@@ -1354,12 +1363,10 @@ use @code{rl_generic_bind} instead.
@deftypefun void rl_macro_dumper (int readable)
Print the key sequences bound to macros and their values, using
the current keymap, to @code{rl_outstream}.
If the application has assigned a value to @code{rl_macro_display_hook},
@code{rl_macro_dumper} calls it instead of printing anything.
If @var{readable} is greater than zero, the list is formatted in such a way
that it can be made part of an @code{inputrc} file and re-read.
If @var{readable} is less than zero, the list is printed in a
"translated" form that can be used by applications that wish to bind
key sequences directly without calling @code{rl_parse_and_bind}
(e.g., by calling @code{rl_generic_bind}).
@end deftypefun
+2 -2
View File
@@ -5,7 +5,7 @@ Copyright (C) 1988-2023 Free Software Foundation, Inc.
@set EDITION 8.3
@set VERSION 8.3
@set UPDATED 17 July 2023
@set UPDATED 31 July 2023
@set UPDATED-MONTH July 2023
@set LASTCHANGE Mon Jul 17 16:47:01 EDT 2023
@set LASTCHANGE Mon Jul 31 10:09:09 EDT 2023
+2
View File
@@ -623,6 +623,8 @@ extern rl_voidfunc_t *rl_redisplay_function;
extern rl_vintfunc_t *rl_prep_term_function;
extern rl_voidfunc_t *rl_deprep_term_function;
extern rl_macro_print_func_t *rl_macro_display_hook;
/* Dispatch variables. */
extern Keymap rl_executing_keymap;
extern Keymap rl_binding_keymap;
+3
View File
@@ -57,6 +57,9 @@ typedef int rl_compignore_func_t (char **);
typedef void rl_compdisp_func_t (char **, int, int);
/* Functions for displaying key bindings. Currently only one. */
typedef void rl_macro_print_func_t (const char *, const char *, int, const char *);
/* Type for input and pre-read hook functions like rl_event_hook */
typedef int rl_hook_func_t (void);
+6 -1
View File
@@ -175,6 +175,12 @@ glob_char_p (const char *s)
{
switch (*s)
{
case '!':
case '^':
case '-':
case '.':
case ':':
case '=':
case '*':
case '[':
case ']':
@@ -183,7 +189,6 @@ glob_char_p (const char *s)
return 1;
case '+':
case '@':
case '!':
if (s[1] == '(') /*(*/
return 1;
break;
+17
View File
@@ -166,3 +166,20 @@ argv[1] = <AA>
argv[2] = <BB>
argv[1] = <AA BB>
argv[1] = <AA BB>
inside1-inside2-outside
BEFOREAA
BB
CC
AFTER
BEFOREAA
BB
CC
AFTER
unbalanced braces}}
combined comsubs
combined comsubs
inside
after: var = inside
after: 42 var = inside
var=inside 42
after: 0 var = inside
+1
View File
@@ -150,3 +150,4 @@ ${THIS_SH} ./comsub22.sub
${THIS_SH} ./comsub23.sub
${THIS_SH} ./comsub24.sub
${THIS_SH} ./comsub25.sub
${THIS_SH} ./comsub26.sub
+36
View File
@@ -0,0 +1,36 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# more tests for nofork comsub functionality
REPLY=outside
echo ${| REPLY=inside1; }-${| REPLY=inside2; }-$REPLY
echo "BEFORE${| printf -v REPLY '%s\n' AA BB CC; }AFTER"
echo "BEFORE${| printf -v REPLY $'%s\n' AA BB CC; }AFTER"
echo ${ echo unbalanced braces; }}}
echo $(echo combined ${| REPLY=comsubs; })
echo ${ echo $(echo combined ${| REPLY=comsubs; }); }
var=outside
echo ${ var=inside; echo $var; }
echo after: var = $var
( echo ${ echo var=inside; exit 42 ; echo var=inside2; } )
echo after: $? var = $var
( echo ${ echo var=inside; return 42 ; echo var=inside2; } $? )
echo after: $? var = $var