mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 07:43:07 +02:00
commit bash-20200323 snapshot
This commit is contained in:
+169
@@ -7619,3 +7619,172 @@ syntax.h
|
||||
|
||||
should output the same thing. From a report from Dan Jacobson
|
||||
<jidanni@jidanni.org> back in 1/2019.
|
||||
|
||||
3/23
|
||||
----
|
||||
subst.c
|
||||
- string_transform: add `U' (convert to uppercase), `u' (convert
|
||||
first character to uppercase), and `L' (convert to lowercase)
|
||||
transformations. Inspired by a discussion with Phil Smith
|
||||
<phil@philsmith.com> back in May, 2019
|
||||
- parameter_brace_transform: make sure `u', `U', and `L' are valid
|
||||
transform operators
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- parameter transformation: document new `U', `u', and `L' operators
|
||||
|
||||
eval.c
|
||||
- execute_prompt_command: if an array variable PROMPT_COMMANDS exists,
|
||||
prefer it to PROMPT_COMMAND and execute all of the commands contained
|
||||
as array elements in index order. From a proposal by Daniel
|
||||
Colascione <dancol@google.com> back in 1/2018
|
||||
- execute_array_command: function for array_walk to use when executing
|
||||
commands in PROMPT_COMMANDS
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- PROMPT_COMMANDS: new array variable
|
||||
|
||||
3/24
|
||||
----
|
||||
builtins/ulimit.def
|
||||
- new -R option, for RLIMIT_RTTIME (max time a real-time process can
|
||||
run without blocking). Patch from Maciej Wolny
|
||||
<maciekwolny123@gmail.com> back in 7/2017
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- ulimit: document new -R option
|
||||
|
||||
lib/readline/{display.c,rlprivate.h}
|
||||
- _rl_clear_screen: now takes an argument saying whether to attempt to
|
||||
clear the terminal scrollback buffer if the right termcap capability
|
||||
exists
|
||||
|
||||
lib/readline/{text.c,readline.h}
|
||||
- rl_clear_display: new bindable command that clears the screen and
|
||||
scrollback buffer
|
||||
|
||||
lib/readline/funmap.c
|
||||
- clear-display: new bindable command name
|
||||
|
||||
lib/readline/emacs_keymap.c
|
||||
- emacs mode M-C-l now bound to clear-display
|
||||
|
||||
doc/bash.1,lib/readline/doc/{readline.3,rluser.texi}
|
||||
- clear-display: document new function and default emacs mode binding
|
||||
|
||||
arrayfunc.c
|
||||
- assign_assoc_from_kvlist: allow compound assignments to associative
|
||||
arrays that do not contain words of the form `[key]=value', assume
|
||||
such lists are of the form (key1 value1 key2 value2). A missing or
|
||||
empty key is an error; a missing value is treated as NULL. You
|
||||
cannot mix the two forms. Inspired by a suggestion from Sebastian
|
||||
Gniazdowski <sgniazdowski@gmail.com> back in 7/2019
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- documented new associative array assignment syntax
|
||||
|
||||
assoc.[ch]
|
||||
- assoc_to_kvpair: new function that returns a string with quoted
|
||||
key/value pairs from given associative array
|
||||
|
||||
array.[ch]
|
||||
- array_to_kvpair: new function that returns a string with quoted
|
||||
key/value pairs from given indexed array (for completeness)
|
||||
|
||||
subst.c
|
||||
- parameter_brace_transform: new operator `K': produces the (possibly
|
||||
quoted) value of a variable, except for arrays, where it expands to
|
||||
indexed or associative array assignments in key/value pair form
|
||||
- string_transform,parameter_list_transform: expand `K' to (possibly
|
||||
quoted) values
|
||||
- array_var_assignment: take a new fourth argument saying which kind
|
||||
of assoc assignment statement to produce; calls array_to_kvpair or
|
||||
assoc_to_kvpair as appropriate and just returns that value if
|
||||
necessary without creating a declare command
|
||||
- array_transform: if the operator is `K', call array_var_assignment
|
||||
with new argument that will produce a list of key/value pairs
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- document new 'K' parameter transformation operator
|
||||
|
||||
3/25
|
||||
----
|
||||
doc/bash.1,lib/readline/doc/{history.3,readline.3}
|
||||
- some text and formatting cleanups from Bjarni Ingi Gislason
|
||||
<bjarniig@rhi.hi.is>
|
||||
|
||||
bashhist.c
|
||||
- SYSLOG_MAXLEN: increase to 1024, since that seems to be what most
|
||||
syslog daemons handle
|
||||
- bash_syslog_history: if the line is longer than SYSLOG_MAXLEN minus
|
||||
the header length, log it in multiple message with a sequence number
|
||||
instead of truncating. Inspired by a report from
|
||||
<sunhuilin@unionpay.com> back in 7/2018
|
||||
|
||||
lib/readline/text.c
|
||||
- rl_activate_mark,rl_deactivate_mark,rl_mark_is_active_p,
|
||||
rl_keep_mark_active: new functions to manage an active region. We
|
||||
don't do anything with an active region yet. Part of a large patch
|
||||
for active regions from Daniel Colascione <dancol@google.com>
|
||||
originally back in 3/2018
|
||||
- rl_clear_screen: call rl_keep_mark_active to keep the region active
|
||||
across the screen refresh
|
||||
- rl_newline: make sure to deactivate the region even though we don't
|
||||
do any redisplay with it yet
|
||||
|
||||
lib/readline/readline.h
|
||||
- rl_activate_mark,rl_deactivate_mark,rl_mark_is_active_p,
|
||||
rl_keep_mark_active: new extern function declarations. They are
|
||||
public functions for now
|
||||
|
||||
lib/readline/readline.c
|
||||
- readline_internal_setup: make sure the region starts out as not
|
||||
active
|
||||
- readline_internal_charloop: make sure to deactivate the mark after
|
||||
a command, unless the command calls rl_keep_mark_active keep it
|
||||
active
|
||||
|
||||
lib/readline/kill.c
|
||||
- rl_bracketed_paste_begin: set rl_mark before inserting the pasted
|
||||
text, so the pasted text defines the region
|
||||
- rl_bracketed_paste_begin: set the region as active after inserting
|
||||
the pasted text
|
||||
|
||||
lib/readline/util.c
|
||||
- _rl_abort_internal: make sure we deactivate the region
|
||||
|
||||
lib/readline/{terminal.c,rlprivate.h}
|
||||
- _rl_cr: new function to just output the term_cr (or '\r'). Part of
|
||||
the active region patch
|
||||
|
||||
lib/readline/display.c
|
||||
- _rl_cr: use where appropriate to replace MSDOS-dependent code and
|
||||
calls to tputs
|
||||
|
||||
lib/readline/terminal.c
|
||||
- get and store the terminal sequences to enter and exit standout
|
||||
(usually some background color) mode
|
||||
|
||||
3/26
|
||||
----
|
||||
subst.[ch]
|
||||
- copy_fifo_list: now returns void *
|
||||
- close_new_fifos: now takes a void * as the first argument, since it's
|
||||
usually the return value from copy_fifo_list
|
||||
- close_new_fifos: (named pipes): cast first argument to a char *,
|
||||
since copy_fifo_list will (someday) return a bitmap
|
||||
- close_new_fifos: (HAVE_DEV_FD): cast first argument to a pid_t *,
|
||||
since it takes a copy of dev_fd_list; use that in the loop to
|
||||
determine whether or not to close file descriptors. First half of
|
||||
fix for bug reported by Valentin Lab <valentin.lab@kalysto.org>
|
||||
- unlink_fifo_list: (named pipes): when compacting the list, make sure
|
||||
to avoid the copy if i == j, and, after copying fifo_list[i] to
|
||||
fifo_list[j], null out fifo_list[i] so we don't try to access it
|
||||
later
|
||||
|
||||
execute_cmd.c
|
||||
- execute_command_internal: don't call reap_procsubs after executing
|
||||
the command. Rest of fix for bug reported by Valentin Lab
|
||||
<valentin.lab@kalysto.org>
|
||||
- execute_command_internal,execute_builtin_or_function: ofifo_list is
|
||||
now a void * instead of a char *
|
||||
|
||||
@@ -927,6 +927,7 @@ tests/assoc7.sub f
|
||||
tests/assoc8.sub f
|
||||
tests/assoc9.sub f
|
||||
tests/assoc10.sub f
|
||||
tests/assoc11.sub f
|
||||
tests/attr.tests f
|
||||
tests/attr.right f
|
||||
tests/attr1.sub f
|
||||
@@ -1213,6 +1214,7 @@ tests/new-exp10.sub f
|
||||
tests/new-exp11.sub f
|
||||
tests/new-exp12.sub f
|
||||
tests/new-exp13.sub f
|
||||
tests/new-exp14.sub f
|
||||
tests/new-exp.right f
|
||||
tests/nquote.tests f
|
||||
tests/nquote.right f
|
||||
@@ -1262,6 +1264,7 @@ tests/printf4.sub f
|
||||
tests/procsub.tests f
|
||||
tests/procsub.right f
|
||||
tests/procsub1.sub f
|
||||
tests/procsub2.sub f
|
||||
tests/quote.tests f
|
||||
tests/quote.right f
|
||||
tests/quote1.sub f
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* chet@ins.cwru.edu
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -874,6 +874,60 @@ int quoted;
|
||||
return(result);
|
||||
}
|
||||
|
||||
char *
|
||||
array_to_kvpair (a, quoted)
|
||||
ARRAY *a;
|
||||
int quoted;
|
||||
{
|
||||
char *result, *valstr, *is;
|
||||
char indstr[INT_STRLEN_BOUND(intmax_t) + 1];
|
||||
ARRAY_ELEMENT *ae;
|
||||
int rsize, rlen, elen;
|
||||
|
||||
if (a == 0 || array_empty (a))
|
||||
return((char *)NULL);
|
||||
|
||||
result = (char *)xmalloc (rsize = 128);
|
||||
result[rlen = 0] = '\0';
|
||||
|
||||
for (ae = element_forw(a->head); ae != a->head; ae = element_forw(ae)) {
|
||||
is = inttostr (element_index(ae), indstr, sizeof(indstr));
|
||||
valstr = element_value (ae) ?
|
||||
(ansic_shouldquote (element_value (ae)) ?
|
||||
ansic_quote (element_value(ae), 0, (int *)0) :
|
||||
sh_double_quote (element_value (ae)))
|
||||
: (char *)NULL;
|
||||
elen = STRLEN (is) + 8 + STRLEN (valstr);
|
||||
RESIZE_MALLOCED_BUFFER (result, rlen, (elen + 1), rsize, rsize);
|
||||
|
||||
strcpy (result + rlen, is);
|
||||
rlen += STRLEN (is);
|
||||
result[rlen++] = ' ';
|
||||
if (valstr) {
|
||||
strcpy (result + rlen, valstr);
|
||||
rlen += STRLEN (valstr);
|
||||
} else {
|
||||
strcpy (result + rlen, "\"\"");
|
||||
rlen += 2;
|
||||
}
|
||||
|
||||
if (element_forw(ae) != a->head)
|
||||
result[rlen++] = ' ';
|
||||
|
||||
FREE (valstr);
|
||||
}
|
||||
RESIZE_MALLOCED_BUFFER (result, rlen, 1, rsize, 8);
|
||||
result[rlen] = '\0';
|
||||
|
||||
if (quoted) {
|
||||
/* This is not as efficient as it could be... */
|
||||
valstr = sh_single_quote (result);
|
||||
free (result);
|
||||
result = valstr;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
char *
|
||||
array_to_assign (a, quoted)
|
||||
ARRAY *a;
|
||||
|
||||
@@ -86,6 +86,7 @@ extern ARRAY *array_assign_list __P((ARRAY *, WORD_LIST *));
|
||||
|
||||
extern char **array_to_argv __P((ARRAY *));
|
||||
|
||||
extern char *array_to_kvpair __P((ARRAY *, int));
|
||||
extern char *array_to_assign __P((ARRAY *, int));
|
||||
extern char *array_to_string __P((ARRAY *, char *, int));
|
||||
extern ARRAY *array_from_string __P((char *, char *));
|
||||
|
||||
+68
-6
@@ -1,6 +1,6 @@
|
||||
/* arrayfunc.c -- High-level array functions used by other parts of the shell. */
|
||||
|
||||
/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -47,12 +47,14 @@ int assoc_expand_once = 0;
|
||||
/* Ditto for indexed array subscripts -- currently unused */
|
||||
int array_expand_once = 0;
|
||||
|
||||
static SHELL_VAR *bind_array_var_internal __P((SHELL_VAR *, arrayind_t, char *, char *, int));
|
||||
static SHELL_VAR *assign_array_element_internal __P((SHELL_VAR *, char *, char *, char *, int, char *, int));
|
||||
static SHELL_VAR *bind_array_var_internal PARAMS((SHELL_VAR *, arrayind_t, char *, char *, int));
|
||||
static SHELL_VAR *assign_array_element_internal PARAMS((SHELL_VAR *, char *, char *, char *, int, char *, int));
|
||||
|
||||
static char *quote_assign __P((const char *));
|
||||
static void quote_array_assignment_chars __P((WORD_LIST *));
|
||||
static char *array_value_internal __P((const char *, int, int, int *, arrayind_t *));
|
||||
static void assign_assoc_from_kvlist PARAMS((SHELL_VAR *, WORD_LIST *, HASH_TABLE *, int));
|
||||
|
||||
static char *quote_assign PARAMS((const char *));
|
||||
static void quote_array_assignment_chars PARAMS((WORD_LIST *));
|
||||
static char *array_value_internal PARAMS((const char *, int, int, int *, arrayind_t *));
|
||||
|
||||
/* Standard error message to use when encountering an invalid array subscript */
|
||||
const char * const bash_badsub_errmsg = N_("bad array subscript");
|
||||
@@ -544,6 +546,51 @@ expand_compound_array_assignment (var, value, flags)
|
||||
return nlist;
|
||||
}
|
||||
|
||||
#if ASSOC_KVPAIR_ASSIGNMENT
|
||||
static void
|
||||
assign_assoc_from_kvlist (var, nlist, h, flags)
|
||||
SHELL_VAR *var;
|
||||
WORD_LIST *nlist;
|
||||
HASH_TABLE *h;
|
||||
int flags;
|
||||
{
|
||||
WORD_LIST *list;
|
||||
char *akey, *aval, *k, *v;
|
||||
int free_aval;
|
||||
|
||||
for (list = nlist; list; list = list->next)
|
||||
{
|
||||
free_aval = 0;
|
||||
|
||||
k = list->word->word;
|
||||
v = list->next ? list->next->word->word : 0;
|
||||
|
||||
if (list->next)
|
||||
list = list->next;
|
||||
|
||||
akey = expand_assignment_string_to_string (k, 0);
|
||||
aval = expand_assignment_string_to_string (v, 0);
|
||||
|
||||
if (akey == 0 || *akey == 0)
|
||||
{
|
||||
err_badarraysub (k);
|
||||
FREE (akey);
|
||||
continue;
|
||||
}
|
||||
if (aval == 0)
|
||||
{
|
||||
aval = (char *)xmalloc (1);
|
||||
aval[0] = '\0'; /* like do_assignment_internal */
|
||||
free_aval = 1;
|
||||
}
|
||||
|
||||
bind_assoc_var_internal (var, h, akey, aval, flags);
|
||||
if (free_aval)
|
||||
free (aval);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Callers ensure that VAR is not NULL. Associative array assignments have not
|
||||
been expanded when this is called, so we don't have to scan through the
|
||||
expanded subscript to find the ending bracket; indexed array assignments
|
||||
@@ -582,6 +629,21 @@ assign_compound_array_list (var, nlist, flags)
|
||||
|
||||
last_ind = (a && (flags & ASS_APPEND)) ? array_max_index (a) + 1 : 0;
|
||||
|
||||
#if ASSOC_KVPAIR_ASSIGNMENT
|
||||
if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) == 0 && nlist->word->word[0] != '[') /*]*/
|
||||
{
|
||||
iflags = flags & ~ASS_APPEND;
|
||||
assign_assoc_from_kvlist (var, nlist, nhash, iflags);
|
||||
if (nhash && nhash != h)
|
||||
{
|
||||
h = assoc_cell (var);
|
||||
var_setassoc (var, nhash);
|
||||
assoc_dispose (h);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (list = nlist; list; list = list->next)
|
||||
{
|
||||
/* Don't allow var+=(values) to make assignments in VALUES append to
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* chet@ins.cwru.edu
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2008,2009,2011 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2008,2009,2011-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -368,6 +368,76 @@ assoc_modcase (h, pat, modop, mflags)
|
||||
return t;
|
||||
}
|
||||
|
||||
char *
|
||||
assoc_to_kvpair (hash, quoted)
|
||||
HASH_TABLE *hash;
|
||||
int quoted;
|
||||
{
|
||||
char *ret;
|
||||
char *istr, *vstr;
|
||||
int i, rsize, rlen, elen;
|
||||
BUCKET_CONTENTS *tlist;
|
||||
|
||||
if (hash == 0 || assoc_empty (hash))
|
||||
return (char *)0;
|
||||
|
||||
ret = xmalloc (rsize = 128);
|
||||
ret[rlen = 0] = '\0';
|
||||
|
||||
for (i = 0; i < hash->nbuckets; i++)
|
||||
for (tlist = hash_items (i, hash); tlist; tlist = tlist->next)
|
||||
{
|
||||
if (ansic_shouldquote (tlist->key))
|
||||
istr = ansic_quote (tlist->key, 0, (int *)0);
|
||||
else if (sh_contains_shell_metas (tlist->key))
|
||||
istr = sh_double_quote (tlist->key);
|
||||
else if (ALL_ELEMENT_SUB (tlist->key[0]) && tlist->key[1] == '\0')
|
||||
istr = sh_double_quote (tlist->key);
|
||||
else
|
||||
istr = tlist->key;
|
||||
|
||||
vstr = tlist->data ? (ansic_shouldquote ((char *)tlist->data) ?
|
||||
ansic_quote ((char *)tlist->data, 0, (int *)0) :
|
||||
sh_double_quote ((char *)tlist->data))
|
||||
: (char *)0;
|
||||
|
||||
elen = STRLEN (istr) + 4 + STRLEN (vstr);
|
||||
RESIZE_MALLOCED_BUFFER (ret, rlen, (elen+1), rsize, rsize);
|
||||
|
||||
strcpy (ret+rlen, istr);
|
||||
rlen += STRLEN (istr);
|
||||
ret[rlen++] = ' ';
|
||||
if (vstr)
|
||||
{
|
||||
strcpy (ret + rlen, vstr);
|
||||
rlen += STRLEN (vstr);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (ret + rlen, "\"\"");
|
||||
rlen += 2;
|
||||
}
|
||||
ret[rlen++] = ' ';
|
||||
|
||||
if (istr != tlist->key)
|
||||
FREE (istr);
|
||||
|
||||
FREE (vstr);
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (ret, rlen, 1, rsize, 8);
|
||||
ret[rlen] = '\0';
|
||||
|
||||
if (quoted)
|
||||
{
|
||||
vstr = sh_single_quote (ret);
|
||||
free (ret);
|
||||
ret = vstr;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
assoc_to_assign (hash, quoted)
|
||||
HASH_TABLE *hash;
|
||||
@@ -417,7 +487,6 @@ assoc_to_assign (hash, quoted)
|
||||
}
|
||||
ret[rlen++] = ' ';
|
||||
|
||||
|
||||
if (istr != tlist->key)
|
||||
FREE (istr);
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ extern HASH_TABLE *assoc_dequote __P((HASH_TABLE *));
|
||||
extern HASH_TABLE *assoc_dequote_escapes __P((HASH_TABLE *));
|
||||
extern HASH_TABLE *assoc_remove_quoted_nulls __P((HASH_TABLE *));
|
||||
|
||||
extern char *assoc_to_kvpair __P((HASH_TABLE *, int));
|
||||
extern char *assoc_to_assign __P((HASH_TABLE *, int));
|
||||
|
||||
extern WORD_LIST *assoc_to_word_list __P((HASH_TABLE *));
|
||||
|
||||
+24
-7
@@ -805,7 +805,9 @@ check_add_history (line, force)
|
||||
}
|
||||
|
||||
#if defined (SYSLOG_HISTORY)
|
||||
#define SYSLOG_MAXLEN 600
|
||||
#define SYSLOG_MAXMSG 1024
|
||||
#define SYSLOG_MAXLEN SYSLOG_MAXMSG
|
||||
#define SYSLOG_MAXHDR 256
|
||||
|
||||
#ifndef OPENLOG_OPTS
|
||||
#define OPENLOG_OPTS 0
|
||||
@@ -821,7 +823,10 @@ void
|
||||
bash_syslog_history (line)
|
||||
const char *line;
|
||||
{
|
||||
char trunc[SYSLOG_MAXLEN];
|
||||
char trunc[SYSLOG_MAXLEN], *msg;
|
||||
char loghdr[SYSLOG_MAXHDR];
|
||||
char seqbuf[32], *seqnum;
|
||||
int hdrlen, msglen, seqlen, chunks, i;
|
||||
static int first = 1;
|
||||
|
||||
if (first)
|
||||
@@ -830,13 +835,25 @@ bash_syslog_history (line)
|
||||
first = 0;
|
||||
}
|
||||
|
||||
if (strlen(line) < SYSLOG_MAXLEN)
|
||||
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY: PID=%d UID=%d %s", getpid(), current_user.uid, line);
|
||||
hdrlen = snprintf (loghdr, sizeof(loghdr), "HISTORY: PID=%d UID=%d", getpid(), current_user.uid);
|
||||
msglen = strlen (line);
|
||||
|
||||
if ((msglen + hdrlen + 1) < SYSLOG_MAXLEN)
|
||||
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "%s %s", loghdr, line);
|
||||
else
|
||||
{
|
||||
strncpy (trunc, line, SYSLOG_MAXLEN);
|
||||
trunc[SYSLOG_MAXLEN - 1] = '\0';
|
||||
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "HISTORY (TRUNCATED): PID=%d UID=%d %s", getpid(), current_user.uid, trunc);
|
||||
chunks = ((msglen + hdrlen) / SYSLOG_MAXLEN) + 1;
|
||||
for (msg = line, i = 0; i < chunks; i++)
|
||||
{
|
||||
seqnum = inttostr (i + 1, seqbuf, sizeof (seqbuf));
|
||||
seqlen = STRLEN (seqnum);
|
||||
|
||||
/* 7 == "(seq=) " */
|
||||
strncpy (trunc, msg, SYSLOG_MAXLEN - hdrlen - seqlen - 7 - 1);
|
||||
trunc[SYSLOG_MAXLEN - 1] = '\0';
|
||||
syslog (SYSLOG_FACILITY|SYSLOG_LEVEL, "%s (seq=%s) %s", loghdr, seqnum, trunc);
|
||||
msg += SYSLOG_MAXLEN - hdrlen - seqlen - 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+6
-2
@@ -52,6 +52,7 @@ Options:
|
||||
-v the size of virtual memory
|
||||
-x the maximum number of file locks
|
||||
-P the maximum number of pseudoterminals
|
||||
-R the maximum time a real-time process can run before blocking
|
||||
-T the maximum number of threads
|
||||
|
||||
Not all options are available on all platforms.
|
||||
@@ -232,8 +233,11 @@ static RESOURCE_LIMITS limits[] = {
|
||||
#ifdef RLIMIT_NPTS
|
||||
{ 'P', RLIMIT_NPTS, 1, "number of pseudoterminals", (char *)NULL },
|
||||
#endif
|
||||
#ifdef RLIMIT_RTTIME
|
||||
{ 'R', RLIMIT_RTTIME, 1, "real-time non-blocking time", "microseconds" },
|
||||
#endif
|
||||
#ifdef RLIMIT_PTHREAD
|
||||
{ 'T', RLIMIT_PTHREAD, 1, "number of threads", (char *)NULL },
|
||||
{ 'T', RLIMIT_PTHREAD, 1, "number of threads", (char *)NULL },
|
||||
#endif
|
||||
#ifdef RLIMIT_SBSIZE
|
||||
{ 'b', RLIMIT_SBSIZE, 1, "socket buffer size", "bytes" },
|
||||
@@ -741,7 +745,7 @@ printone (limind, curlim, pdesc)
|
||||
else
|
||||
sprintf (unitstr, "(-%c) ", limits[limind].option);
|
||||
|
||||
printf ("%-20s %16s", limits[limind].description, unitstr);
|
||||
printf ("%-20s %20s", limits[limind].description, unitstr);
|
||||
}
|
||||
if (curlim == RLIM_INFINITY)
|
||||
puts ("unlimited");
|
||||
|
||||
@@ -187,3 +187,7 @@
|
||||
interactive shells; define to 1 for the historical behavior of enabling
|
||||
when the shell is interactive. */
|
||||
#define HISTEXPAND_DEFAULT 1
|
||||
|
||||
/* 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
|
||||
|
||||
+56
-23
@@ -1309,9 +1309,11 @@ PPAARRAAMMEETTEERRSS
|
||||
while the shell is running, bbaasshh enables _p_o_s_i_x _m_o_d_e, as if the
|
||||
command _s_e_t _-_o _p_o_s_i_x had been executed. When the shell enters
|
||||
_p_o_s_i_x _m_o_d_e, it sets this variable if it was not already set.
|
||||
PPRROOMMPPTT__CCOOMMMMAANNDD
|
||||
If set, the value is executed as a command prior to issuing each
|
||||
primary prompt.
|
||||
PPRROOMMPPTT__CCOOMMMMAANNDDSS
|
||||
If this array variable is set, the value of each set element is
|
||||
executed as a command prior to issuing each primary prompt. If
|
||||
this is not set, but PPRROOMMPPTT__CCOOMMMMAANNDD is set to a value, its value
|
||||
is used as a command to execute instead.
|
||||
PPRROOMMPPTT__DDIIRRTTRRIIMM
|
||||
If set to a number greater than zero, the value is used as the
|
||||
number of trailing directory components to retain when expanding
|
||||
@@ -1427,14 +1429,22 @@ PPAARRAAMMEETTEERRSS
|
||||
rreeaaddoonnllyy builtins. Each attribute applies to all members of an array.
|
||||
|
||||
Arrays are assigned to using compound assignments of the form
|
||||
_n_a_m_e=((value_1 ... value_n)), where each _v_a_l_u_e is of the form [_s_u_b_-
|
||||
_n_a_m_e=((value_1 ... value_n)), where each _v_a_l_u_e may be of the form [_s_u_b_-
|
||||
_s_c_r_i_p_t]=_s_t_r_i_n_g. Indexed array assignments do not require anything but
|
||||
_s_t_r_i_n_g. When assigning to indexed arrays, if the optional brackets and
|
||||
subscript are supplied, that index is assigned to; otherwise the index
|
||||
of the element assigned is the last index assigned to by the statement
|
||||
plus one. Indexing starts at zero.
|
||||
|
||||
When assigning to an associative array, the subscript is required.
|
||||
When assigning to an associative array, the words in a compound assign-
|
||||
ment may be either assignment statements, for which the subscript is
|
||||
required, or a list of words that is interpreted as a sequence of al-
|
||||
ternating keys and values: _n_a_m_e=(( _k_e_y_1 _v_a_l_u_e_1 _k_e_y_2 _v_a_l_u_e_2 ...)). These
|
||||
are treated identically to _n_a_m_e=(( [_k_e_y_1]=_v_a_l_u_e_1 [_k_e_y_2]=_v_a_l_u_e_2 ...)).
|
||||
The first word in the list determines how the remaining words are in-
|
||||
terpreted; all assignments in a list must be of the same type. When
|
||||
using key/value pairs, the keys may not be missing or empty; a final
|
||||
missing value is treated like the empty string.
|
||||
|
||||
This syntax is also accepted by the ddeeccllaarree builtin. Individual array
|
||||
elements may be assigned to using the _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e syntax in-
|
||||
@@ -1825,6 +1835,15 @@ EEXXPPAANNSSIIOONN
|
||||
itself, depending on the value of _o_p_e_r_a_t_o_r. Each _o_p_e_r_a_t_o_r is a
|
||||
single letter:
|
||||
|
||||
UU The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
with lowercase alphabetic characters converted to upper-
|
||||
case.
|
||||
uu The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
with the first character converted to uppercase, if it is
|
||||
alphabetic.
|
||||
LL The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
with uppercase alphabetic characters converted to lower-
|
||||
case.
|
||||
QQ The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
quoted in a format that can be reused as input.
|
||||
EE The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r
|
||||
@@ -1836,6 +1855,9 @@ EEXXPPAANNSSIIOONN
|
||||
AA The expansion is a string in the form of an assignment
|
||||
statement or ddeeccllaarree command that, if evaluated, will
|
||||
recreate _p_a_r_a_m_e_t_e_r with its attributes and value.
|
||||
KK Identical to AA, except that it prints compound assignment
|
||||
statements that recreate associative arrays as a sequence
|
||||
of key-value pairs (see AArrrraayyss above).
|
||||
aa The expansion is a string consisting of flag values rep-
|
||||
resenting _p_a_r_a_m_e_t_e_r's attributes.
|
||||
|
||||
@@ -3511,10 +3533,14 @@ RREEAADDLLIINNEE
|
||||
if the current Readline line does not take up more than one
|
||||
physical line or if the length of the current Readline line is
|
||||
not greater than the length of the prompt plus the screen width.
|
||||
cclleeaarr--ddiissppllaayy ((MM--CC--ll))
|
||||
Clear the screen and, if possible, the terminal's scrollback
|
||||
buffer, then redraw the current line, leaving the current line
|
||||
at the top of the screen.
|
||||
cclleeaarr--ssccrreeeenn ((CC--ll))
|
||||
Clear the screen leaving the current line at the top of the
|
||||
screen. With an argument, refresh the current line without
|
||||
clearing the screen.
|
||||
Clear the screen, then redraw the current line, leaving the cur-
|
||||
rent line at the top of the screen. With an argument, refresh
|
||||
the current line without clearing the screen.
|
||||
rreeddrraaww--ccuurrrreenntt--lliinnee
|
||||
Refresh the current line.
|
||||
|
||||
@@ -4617,8 +4643,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
is resumed. The return value is 0 unless _n is not greater than
|
||||
or equal to 1.
|
||||
|
||||
ddeeccllaarree [--aaAAffFFggiillnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
|
||||
ttyyppeesseett [--aaAAffFFggiillnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
|
||||
ddeeccllaarree [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
|
||||
ttyyppeesseett [--aaAAffFFggiiIIllnnrrttuuxx] [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
|
||||
Declare variables and/or give them attributes. If no _n_a_m_es are
|
||||
given then display the values of variables. The --pp option will
|
||||
display the attributes and values of each _n_a_m_e. When --pp is used
|
||||
@@ -4635,9 +4661,13 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
_n_a_m_e is defined are displayed as well. The --FF option implies
|
||||
--ff. The --gg option forces variables to be created or modified at
|
||||
the global scope, even when ddeeccllaarree is executed in a shell func-
|
||||
tion. It is ignored in all other cases. The following options
|
||||
can be used to restrict output to variables with the specified
|
||||
attribute or to give variables attributes:
|
||||
tion. It is ignored in all other cases. The --II option causes
|
||||
local variables to inherit the attributes (except the _n_a_m_e_r_e_f
|
||||
attribute) and value of any existing variable with the same _n_a_m_e
|
||||
at a surrounding scope. If there is no existing variable, the
|
||||
local variable is initially unset. The following options can be
|
||||
used to restrict output to variables with the specified attri-
|
||||
bute or to give variables attributes:
|
||||
--aa Each _n_a_m_e is an indexed array variable (see AArrrraayyss
|
||||
above).
|
||||
--AA Each _n_a_m_e is an associative array variable (see AArrrraayyss
|
||||
@@ -5970,7 +6000,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
function lookup, as with the ccoommmmaanndd builtin. ttyyppee returns true
|
||||
if all of the arguments are found, false if any are not found.
|
||||
|
||||
uulliimmiitt [--HHSSaabbccddeeffiikkllmmnnppqqrrssttuuvvxxPPTT [_l_i_m_i_t]]
|
||||
uulliimmiitt [--HHSSaabbccddeeffiikkllmmnnppqqrrssttuuvvxxPPRRTT [_l_i_m_i_t]]
|
||||
Provides control over the resources available to the shell and
|
||||
to processes started by it, on systems that allow such control.
|
||||
The --HH and --SS options specify that the hard or soft limit is set
|
||||
@@ -6011,16 +6041,19 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
|
||||
shell and, on some systems, to its children
|
||||
--xx The maximum number of file locks
|
||||
--PP The maximum number of pseudoterminals
|
||||
--RR The maximum time a real-time process can run before
|
||||
blocking, in microseconds
|
||||
--TT The maximum number of threads
|
||||
|
||||
If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the
|
||||
new value of the specified resource. If no option is given,
|
||||
then --ff is assumed. Values are in 1024-byte increments, except
|
||||
for --tt, which is in seconds; --pp, which is in units of 512-byte
|
||||
blocks; --PP, --TT, --bb, --kk, --nn, and --uu, which are unscaled values;
|
||||
and, when in posix mode, --cc and --ff, which are in 512-byte incre-
|
||||
ments. The return status is 0 unless an invalid option or argu-
|
||||
ment is supplied, or an error occurs while setting a new limit.
|
||||
If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the
|
||||
new value of the specified resource. If no option is given,
|
||||
then --ff is assumed. Values are in 1024-byte increments, except
|
||||
for --tt, which is in seconds; --RR, which is in microseconds; --pp,
|
||||
which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and
|
||||
--uu, which are unscaled values; and, when in posix mode, --cc and
|
||||
--ff, which are in 512-byte increments. The return status is 0
|
||||
unless an invalid option or argument is supplied, or an error
|
||||
occurs while setting a new limit.
|
||||
|
||||
uummaasskk [--pp] [--SS] [_m_o_d_e]
|
||||
The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with
|
||||
@@ -6209,4 +6242,4 @@ BBUUGGSS
|
||||
|
||||
|
||||
|
||||
GNU Bash 5.0 2020 January 29 BASH(1)
|
||||
GNU Bash 5.0 2020 March 24 BASH(1)
|
||||
|
||||
+63
-73
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Tue Mar 17 18:27:36 EDT 2020
|
||||
.\" Last Change: Tue Mar 24 16:38:43 EDT 2020
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2020 March 17" "GNU Bash 5.0"
|
||||
.TH BASH 1 "2020 March 24" "GNU Bash 5.0"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -396,7 +396,7 @@ files, the
|
||||
option has no effect.
|
||||
A non-interactive shell invoked with the name
|
||||
.B sh
|
||||
does not attempt to read any other startup files.
|
||||
does not attempt to read any other startup files.
|
||||
When invoked as
|
||||
.BR sh ,
|
||||
.B bash
|
||||
@@ -452,7 +452,6 @@ and the effective user id is set to the real user id.
|
||||
If the \fB\-p\fP option is supplied at invocation, the startup behavior is
|
||||
the same, but the effective user id is not reset.
|
||||
.SH DEFINITIONS
|
||||
.PP
|
||||
The following definitions are used throughout the rest of this
|
||||
document.
|
||||
.PD 0
|
||||
@@ -481,7 +480,6 @@ A character that, when unquoted, separates words. One of the following:
|
||||
.if t \fB| & ; ( ) < > space tab newline\fP
|
||||
.if n \fB| & ; ( ) < > space tab newline\fP
|
||||
.RE
|
||||
.PP
|
||||
.TP
|
||||
.B control operator
|
||||
A \fItoken\fP that performs a control function. It is one of the following
|
||||
@@ -511,7 +509,6 @@ command:
|
||||
.if t .RE
|
||||
.SH "SHELL GRAMMAR"
|
||||
.SS Simple Commands
|
||||
.PP
|
||||
A \fIsimple command\fP is a sequence of optional variable assignments
|
||||
followed by \fBblank\fP-separated words and redirections, and
|
||||
terminated by a \fIcontrol operator\fP. The first word
|
||||
@@ -522,7 +519,6 @@ The return value of a \fIsimple command\fP is its exit status, or
|
||||
128+\fIn\^\fP if the command is terminated by signal
|
||||
.IR n .
|
||||
.SS Pipelines
|
||||
.PP
|
||||
A \fIpipeline\fP is a sequence of one or more commands separated by
|
||||
one of the control operators
|
||||
.B |
|
||||
@@ -599,7 +595,6 @@ If the \fBlastpipe\fP option is enabled using the \fBshopt\fP builtin
|
||||
(see the description of \fBshopt\fP below),
|
||||
the last element of a pipeline may be run by the shell process.
|
||||
.SS Lists
|
||||
.PP
|
||||
A \fIlist\fP is a sequence of one or more pipelines separated by one
|
||||
of the operators
|
||||
.BR ; ,
|
||||
@@ -657,7 +652,6 @@ An OR list has the form
|
||||
.RS
|
||||
.PP
|
||||
\fIcommand1\fP \fB||\fP \fIcommand2\fP
|
||||
.PP
|
||||
.RE
|
||||
.PP
|
||||
.I command2
|
||||
@@ -668,7 +662,6 @@ The return status of
|
||||
AND and OR lists is the exit status of the last command
|
||||
executed in the list.
|
||||
.SS Compound Commands
|
||||
.PP
|
||||
A \fIcompound command\fP is one of the following.
|
||||
In most cases a \fIlist\fP in a command's description may be separated from
|
||||
the rest of the command by one or more newlines, and may be followed by a
|
||||
@@ -942,7 +935,6 @@ is the exit status
|
||||
of the last command executed in \fIlist-2\fP, or zero if
|
||||
none was executed.
|
||||
.SS Coprocesses
|
||||
.PP
|
||||
A \fIcoprocess\fP is a shell command preceded by the \fBcoproc\fP reserved
|
||||
word.
|
||||
A coprocess is executed asynchronously in a subshell, as if the command
|
||||
@@ -989,7 +981,6 @@ Since the coprocess is created as an asynchronous command,
|
||||
the \fBcoproc\fP command always returns success.
|
||||
The return status of a coprocess is the exit status of \fIcommand\fP.
|
||||
.SS Shell Function Definitions
|
||||
.PP
|
||||
A shell function is an object that is called like a simple command and
|
||||
executes a compound command with a new set of positional parameters.
|
||||
Shell functions are declared as follows:
|
||||
@@ -1323,7 +1314,6 @@ Namerefs can be unset using the \fB\-n\fP option to the \fBunset\fP builtin.
|
||||
Otherwise, if \fBunset\fP is executed with the name of a nameref variable
|
||||
as an argument, the variable referenced by the nameref variable will be unset.
|
||||
.SS Positional Parameters
|
||||
.PP
|
||||
A
|
||||
.I positional parameter
|
||||
is a parameter denoted by one or more
|
||||
@@ -1344,7 +1334,6 @@ digit is expanded, it must be enclosed in braces (see
|
||||
.B EXPANSION
|
||||
below).
|
||||
.SS Special Parameters
|
||||
.PP
|
||||
The shell treats several parameters specially. These parameters may
|
||||
only be referenced; assignment to them is not allowed.
|
||||
.PD 0
|
||||
@@ -1402,7 +1391,7 @@ Expands to the exit status of the most recently executed foreground
|
||||
pipeline.
|
||||
.TP
|
||||
.B \-
|
||||
Expands to the current option flags as specified upon invocation,
|
||||
Expands to the current option flags as specified upon invocation,
|
||||
by the
|
||||
.B set
|
||||
builtin command, or those set by the shell itself
|
||||
@@ -1442,7 +1431,6 @@ to the filename used to invoke
|
||||
as given by argument zero.
|
||||
.PD
|
||||
.SS Shell Variables
|
||||
.PP
|
||||
The following variables are set by the shell:
|
||||
.PP
|
||||
.PD 0
|
||||
@@ -2161,7 +2149,7 @@ filename completion (see
|
||||
.SM
|
||||
.B READLINE
|
||||
below).
|
||||
A filename whose suffix matches one of the entries in
|
||||
A filename whose suffix matches one of the entries in
|
||||
.SM
|
||||
.B FIGNORE
|
||||
is excluded from the list of matched filenames.
|
||||
@@ -2469,9 +2457,13 @@ had been executed.
|
||||
When the shell enters \fIposix mode\fP, it sets this variable if it was
|
||||
not already set.
|
||||
.TP
|
||||
.B PROMPT_COMMANDS
|
||||
If this array variable is set,
|
||||
the value of each set element is executed as a command
|
||||
prior to issuing each primary prompt.
|
||||
If this is not set, but
|
||||
.B PROMPT_COMMAND
|
||||
If set, the value is executed as a command prior to issuing each primary
|
||||
prompt.
|
||||
is set to a value, its value is used as a command to execute instead.
|
||||
.TP
|
||||
.B PROMPT_DIRTRIM
|
||||
If set to a number greater than zero, the value is used as the number of
|
||||
@@ -2684,14 +2676,24 @@ builtins. Each attribute applies to all members of an array.
|
||||
.PP
|
||||
Arrays are assigned to using compound assignments of the form
|
||||
\fIname\fP=\fB(\fPvalue\fI1\fP ... value\fIn\fP\fB)\fP, where each
|
||||
\fIvalue\fP is of the form [\fIsubscript\fP]=\fIstring\fP.
|
||||
\fIvalue\fP may be of the form [\fIsubscript\fP]=\fIstring\fP.
|
||||
Indexed array assignments do not require anything but \fIstring\fP.
|
||||
When assigning to indexed arrays, if the optional brackets and subscript
|
||||
are supplied, that index is assigned to;
|
||||
otherwise the index of the element assigned is the last index assigned
|
||||
to by the statement plus one. Indexing starts at zero.
|
||||
.PP
|
||||
When assigning to an associative array, the subscript is required.
|
||||
When assigning to an associative array, the words in a compound assignment
|
||||
may be either assignment statements, for which the subscript is required,
|
||||
or a list of words that is interpreted as a sequence of alternating keys
|
||||
and values:
|
||||
\fIname\fP=\fB( \fP\fIkey1 value1 key2 value2\fP ...\fB)\fP.
|
||||
These are treated identically to
|
||||
\fIname\fP=\fB(\fP [\fIkey1\fP]=\fIvalue1\fP [\fIkey2\fP]=\fIvalue2\fP ...\fB)\fP.
|
||||
The first word in the list determines how the remaining words
|
||||
are interpreted; all assignments in a list must be of the same type.
|
||||
When using key/value pairs, the keys may not be missing or empty;
|
||||
a final missing value is treated like the empty string.
|
||||
.PP
|
||||
This syntax is also accepted by the
|
||||
.B declare
|
||||
@@ -2830,7 +2832,6 @@ as explained above (see
|
||||
.SM
|
||||
.BR PARAMETERS ).
|
||||
.SS Brace Expansion
|
||||
.PP
|
||||
.I "Brace expansion"
|
||||
is a mechanism by which arbitrary strings
|
||||
may be generated. This mechanism is similar to
|
||||
@@ -2928,7 +2929,6 @@ command (see
|
||||
.B SHELL BUILTIN COMMANDS
|
||||
below).
|
||||
.SS Tilde Expansion
|
||||
.PP
|
||||
If a word begins with an unquoted tilde character (`\fB~\fP'), all of
|
||||
the characters preceding the first unquoted slash (or all characters,
|
||||
if there is no unquoted slash) are considered a \fItilde-prefix\fP.
|
||||
@@ -2991,7 +2991,6 @@ when they appear as arguments to simple commands.
|
||||
Bash does not do this, except for the \fIdeclaration\fP commands listed
|
||||
above, when in \fIposix mode\fP.
|
||||
.SS Parameter Expansion
|
||||
.PP
|
||||
The `\fB$\fP' character introduces parameter expansion,
|
||||
command substitution, or arithmetic expansion. The parameter name
|
||||
or symbol to be expanded may be enclosed in braces, which
|
||||
@@ -3355,6 +3354,18 @@ or information about \fIparameter\fP itself, depending on the value of
|
||||
.RS
|
||||
.PD 0
|
||||
.TP
|
||||
.B U
|
||||
The expansion is a string that is the value of \fIparameter\fP with lowercase
|
||||
alphabetic characters converted to uppercase.
|
||||
.TP
|
||||
.B u
|
||||
The expansion is a string that is the value of \fIparameter\fP with the first
|
||||
character converted to uppercase, if it is alphabetic.
|
||||
.TP
|
||||
.B L
|
||||
The expansion is a string that is the value of \fIparameter\fP with uppercase
|
||||
alphabetic characters converted to lowercase.
|
||||
.TP
|
||||
.B Q
|
||||
The expansion is a string that is the value of \fIparameter\fP quoted in a
|
||||
format that can be reused as input.
|
||||
@@ -3372,6 +3383,12 @@ The expansion is a string in the form of
|
||||
an assignment statement or \fBdeclare\fP command that, if
|
||||
evaluated, will recreate \fIparameter\fP with its attributes and value.
|
||||
.TP
|
||||
.B K
|
||||
Produces a possibly-quoted version of the value of \fIparameter\fP,
|
||||
except that it prints the values of
|
||||
indexed and associative arrays as a sequence of quoted key-value pairs
|
||||
(see \fBArrays\fP above).
|
||||
.TP
|
||||
.B a
|
||||
The expansion is a string consisting of flag values representing
|
||||
\fIparameter\fP's attributes.
|
||||
@@ -3398,7 +3415,6 @@ The result of the expansion is subject to word splitting and pathname
|
||||
expansion as described below.
|
||||
.RE
|
||||
.SS Command Substitution
|
||||
.PP
|
||||
\fICommand substitution\fP allows the output of a command to replace
|
||||
the command name. There are two forms:
|
||||
.RS
|
||||
@@ -3436,7 +3452,6 @@ escape the inner backquotes with backslashes.
|
||||
If the substitution appears within double quotes, word splitting and
|
||||
pathname expansion are not performed on the results.
|
||||
.SS Arithmetic Expansion
|
||||
.PP
|
||||
Arithmetic expansion allows the evaluation of an arithmetic expression
|
||||
and the substitution of the result. The format for arithmetic expansion is:
|
||||
.RS
|
||||
@@ -3462,7 +3477,6 @@ is invalid,
|
||||
.B bash
|
||||
prints a message indicating failure and no substitution occurs.
|
||||
.SS Process Substitution
|
||||
.PP
|
||||
\fIProcess substitution\fP allows a process's input or output to be
|
||||
referred to using a filename.
|
||||
It takes the form of
|
||||
@@ -3486,7 +3500,6 @@ simultaneously with parameter and variable expansion,
|
||||
command substitution,
|
||||
and arithmetic expansion.
|
||||
.SS Word Splitting
|
||||
.PP
|
||||
The shell scans the results of
|
||||
parameter expansion,
|
||||
command substitution,
|
||||
@@ -3571,7 +3584,6 @@ null argument removal.
|
||||
Note that if no expansion occurs, no splitting
|
||||
is performed.
|
||||
.SS Pathname Expansion
|
||||
.PP
|
||||
After word splitting,
|
||||
unless the
|
||||
.B \-f
|
||||
@@ -3831,7 +3843,6 @@ contain multiple matches.
|
||||
Using separate matches against shorter strings, or using arrays of
|
||||
strings instead of a single long string, may be faster.
|
||||
.SS Quote Removal
|
||||
.PP
|
||||
After the preceding expansions, all unquoted occurrences of the
|
||||
characters
|
||||
.BR \e ,
|
||||
@@ -3947,7 +3958,6 @@ Redirections using file descriptors greater than 9 should be used with
|
||||
care, as they may conflict with file descriptors the shell uses
|
||||
internally.
|
||||
.SS Redirecting Input
|
||||
.PP
|
||||
Redirection of input causes the file whose name results from
|
||||
the expansion of
|
||||
.I word
|
||||
@@ -3963,7 +3973,6 @@ The general format for redirecting input is:
|
||||
[\fIn\fP]\fB<\fP\fIword\fP
|
||||
.RE
|
||||
.SS Redirecting Output
|
||||
.PP
|
||||
Redirection of output causes the file whose name results from
|
||||
the expansion of
|
||||
.I word
|
||||
@@ -4000,7 +4009,6 @@ option to the
|
||||
builtin command is not enabled, the redirection is attempted even
|
||||
if the file named by \fIword\fP exists.
|
||||
.SS Appending Redirected Output
|
||||
.PP
|
||||
Redirection of output in this fashion
|
||||
causes the file whose name results from
|
||||
the expansion of
|
||||
@@ -4016,9 +4024,7 @@ The general format for appending output is:
|
||||
.PP
|
||||
[\fIn\fP]\fB>>\fP\fIword\fP
|
||||
.RE
|
||||
.PP
|
||||
.SS Redirecting Standard Output and Standard Error
|
||||
.PP
|
||||
This construct allows both the
|
||||
standard output (file descriptor 1) and
|
||||
the standard error output (file descriptor 2)
|
||||
@@ -4049,7 +4055,6 @@ When using the second form, \fIword\fP may not expand to a number or
|
||||
(see \fBDuplicating File Descriptors\fP below) for compatibility
|
||||
reasons.
|
||||
.SS Appending Standard Output and Standard Error
|
||||
.PP
|
||||
This construct allows both the
|
||||
standard output (file descriptor 1) and
|
||||
the standard error output (file descriptor 2)
|
||||
@@ -4071,7 +4076,6 @@ This is semantically equivalent to
|
||||
.PP
|
||||
(see \fBDuplicating File Descriptors\fP below).
|
||||
.SS Here Documents
|
||||
.PP
|
||||
This type of redirection instructs the shell to read input from the
|
||||
current source until a line containing only
|
||||
.I delimiter
|
||||
@@ -4138,7 +4142,6 @@ The result is supplied as a single string, with a newline appended,
|
||||
to the command on its
|
||||
standard input (or file descriptor \fIn\fP if \fIn\fP is specified).
|
||||
.SS "Duplicating File Descriptors"
|
||||
.PP
|
||||
The redirection operator
|
||||
.RS
|
||||
.PP
|
||||
@@ -4187,7 +4190,6 @@ As a special case, if \fIn\fP is omitted, and \fIword\fP does not
|
||||
expand to one or more digits or \fB\-\fP, the standard output and standard
|
||||
error are redirected as described previously.
|
||||
.SS "Moving File Descriptors"
|
||||
.PP
|
||||
The redirection operator
|
||||
.RS
|
||||
.PP
|
||||
@@ -4209,7 +4211,6 @@ moves the file descriptor \fIdigit\fP to file descriptor
|
||||
.IR n ,
|
||||
or the standard output (file descriptor 1) if \fIn\fP is not specified.
|
||||
.SS "Opening File Descriptors for Reading and Writing"
|
||||
.PP
|
||||
The redirection operator
|
||||
.RS
|
||||
.PP
|
||||
@@ -4433,7 +4434,7 @@ shell option is enabled).
|
||||
Functions may be exported so that subshells
|
||||
automatically have them defined with the
|
||||
.B \-f
|
||||
option to the
|
||||
option to the
|
||||
.B export
|
||||
builtin.
|
||||
A function definition may be deleted using the \fB\-f\fP option to
|
||||
@@ -4726,7 +4727,7 @@ When used with the \fB[[\fP command,
|
||||
.I Arg1
|
||||
and
|
||||
.I Arg2
|
||||
are evaluated as arithmetic expressions (see
|
||||
are evaluated as arithmetic expressions (see
|
||||
.SM
|
||||
.B "ARITHMETIC EVALUATION"
|
||||
above).
|
||||
@@ -4970,7 +4971,6 @@ invokes an external command, the variable
|
||||
is set to the full filename of the command and passed to that
|
||||
command in its environment.
|
||||
.SH "EXIT STATUS"
|
||||
.PP
|
||||
The exit status of an executed command is the value returned by the
|
||||
\fIwaitpid\fP system call or equivalent function. Exit statuses
|
||||
fall between 0 and 255, though, as explained below, the shell may
|
||||
@@ -5141,7 +5141,7 @@ Background processes which attempt to read from (write to when
|
||||
terminal are sent a
|
||||
.SM
|
||||
.B SIGTTIN (SIGTTOU)
|
||||
signal by the kernel's terminal driver,
|
||||
signal by the kernel's terminal driver,
|
||||
which, unless caught, suspends the process.
|
||||
.PP
|
||||
If the operating system on which
|
||||
@@ -5442,7 +5442,6 @@ options to the
|
||||
.B set
|
||||
builtin.
|
||||
.SS "Readline Notation"
|
||||
.PP
|
||||
In this section, the Emacs-style notation is used to denote
|
||||
keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
|
||||
means Control\-N. Similarly,
|
||||
@@ -5478,7 +5477,6 @@ accumulated into one unit, which can be yanked all at once.
|
||||
Commands which do not kill text separate the chunks of text
|
||||
on the kill ring.
|
||||
.SS "Readline Initialization"
|
||||
.PP
|
||||
Readline is customized by putting commands in an initialization
|
||||
file (the \fIinputrc\fP file).
|
||||
The name of this file is taken from the value of the
|
||||
@@ -5532,7 +5530,6 @@ and
|
||||
In addition to command names, readline allows keys to be bound
|
||||
to a string that is inserted when the key is pressed (a \fImacro\fP).
|
||||
.SS "Readline Key Bindings"
|
||||
.PP
|
||||
The syntax for controlling key bindings in the
|
||||
.I inputrc
|
||||
file is simple. All that is required is the name of the
|
||||
@@ -5683,7 +5680,6 @@ builtin command (see
|
||||
.B SHELL BUILTIN COMMANDS
|
||||
below).
|
||||
.SS "Readline Variables"
|
||||
.PP
|
||||
Readline has variables that can be used to further customize its
|
||||
behavior. A variable may be set in the
|
||||
.I inputrc
|
||||
@@ -6004,7 +6000,6 @@ by \fIstat\fP(2) is appended to the filename when listing possible
|
||||
completions.
|
||||
.PD
|
||||
.SS "Readline Conditional Constructs"
|
||||
.PP
|
||||
Readline implements a facility similar in spirit to the conditional
|
||||
compilation features of the C preprocessor which allows key
|
||||
bindings and variable settings to be performed as the result
|
||||
@@ -6056,7 +6051,7 @@ The version number supplied on the right side of the operator consists
|
||||
of a major version number, an optional decimal point, and an optional
|
||||
minor version (e.g., \fB7.1\fP). If the minor version is omitted, it
|
||||
is assumed to be \fB0\fP.
|
||||
The operator may be separated from the string \fBversion\fP
|
||||
The operator may be separated from the string \fBversion\fP
|
||||
and from the version number argument by whitespace.
|
||||
.IP \fBapplication\fP
|
||||
The \fBapplication\fP construct is used to include
|
||||
@@ -6102,7 +6097,6 @@ would read \fI/etc/inputrc\fP:
|
||||
.fi
|
||||
.RE
|
||||
.SS Searching
|
||||
.PP
|
||||
Readline provides commands for searching through the command history
|
||||
(see
|
||||
.SM
|
||||
@@ -6145,7 +6139,6 @@ Non-incremental searches read the entire search string before starting
|
||||
to search for matching history lines. The search string may be
|
||||
typed by the user or be part of the contents of the current line.
|
||||
.SS "Readline Command Names"
|
||||
.PP
|
||||
The following is a list of the names of the commands and the default
|
||||
key sequences to which they are bound.
|
||||
Command names without an accompanying key sequence are unbound by default.
|
||||
@@ -6154,7 +6147,6 @@ position, and \fImark\fP refers to a cursor position saved by the
|
||||
\fBset\-mark\fP command.
|
||||
The text between the point and mark is referred to as the \fIregion\fP.
|
||||
.SS Commands for Moving
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B beginning\-of\-line (C\-a)
|
||||
@@ -6188,7 +6180,7 @@ Words are delimited by non-quoted shell metacharacters.
|
||||
.B previous\-screen\-line
|
||||
Attempt to move point to the same physical screen column on the previous
|
||||
physical screen line. This will not have the desired effect if the current
|
||||
Readline line does not take up more than one physical line or if point is not
|
||||
Readline line does not take up more than one physical line or if point is not
|
||||
greater than the length of the prompt plus the screen width.
|
||||
.TP
|
||||
.B next\-screen\-line
|
||||
@@ -6198,8 +6190,15 @@ Readline line does not take up more than one physical line or if the length
|
||||
of the current Readline line is not greater than the length of the prompt
|
||||
plus the screen width.
|
||||
.TP
|
||||
.B clear\-display (M\-C\-l)
|
||||
Clear the screen and, if possible, the terminal's scrollback buffer,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
.TP
|
||||
.B clear\-screen (C\-l)
|
||||
Clear the screen leaving the current line at the top of the screen.
|
||||
Clear the screen,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
With an argument, refresh the current line without clearing the
|
||||
screen.
|
||||
.TP
|
||||
@@ -6207,7 +6206,6 @@ screen.
|
||||
Refresh the current line.
|
||||
.PD
|
||||
.SS Commands for Manipulating the History
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B accept\-line (Newline, Return)
|
||||
@@ -6260,7 +6258,7 @@ between the start of the current line and the point.
|
||||
This is a non-incremental search.
|
||||
.TP
|
||||
.B history\-substring\-search\-backward
|
||||
Search backward through the history for the string of characters
|
||||
Search backward through the history for the string of characters
|
||||
between the start of the current line and the current cursor
|
||||
position (the \fIpoint\fP).
|
||||
The search string may match anywhere in a history line.
|
||||
@@ -6349,7 +6347,6 @@ commands.
|
||||
and \fIemacs\fP as the editor, in that order.
|
||||
.PD
|
||||
.SS Commands for Changing Text
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B \fIend\-of\-file\fP (usually C\-d)
|
||||
@@ -6424,7 +6421,6 @@ Characters bound to \fBbackward\-delete\-char\fP replace the character
|
||||
before point with a space. By default, this command is unbound.
|
||||
.PD
|
||||
.SS Killing and Yanking
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B kill\-line (C\-k)
|
||||
@@ -6495,7 +6491,6 @@ or
|
||||
.BR yank\-pop .
|
||||
.PD
|
||||
.SS Numeric Arguments
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B digit\-argument (M\-0, M\-1, ..., M\-\-)
|
||||
@@ -6517,7 +6512,6 @@ first time makes the argument count four, a second time makes the
|
||||
argument count sixteen, and so on.
|
||||
.PD
|
||||
.SS Completing
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B complete (TAB)
|
||||
@@ -6622,7 +6616,6 @@ enclosed within braces so the list is available to the shell (see
|
||||
above).
|
||||
.PD
|
||||
.SS Keyboard Macros
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B start\-kbd\-macro (C\-x (\^)
|
||||
@@ -6641,7 +6634,6 @@ Print the last keyboard macro defined in a format suitable for the
|
||||
\fIinputrc\fP file.
|
||||
.PD
|
||||
.SS Miscellaneous
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B re\-read\-init\-file (C\-x C\-r)
|
||||
@@ -6655,8 +6647,8 @@ ring the terminal's bell (subject to the setting of
|
||||
.TP
|
||||
.B do\-lowercase\-version (M\-A, M\-B, M\-\fIx\fP, ...)
|
||||
If the metafied character \fIx\fP is uppercase, run the command
|
||||
that is bound to the corresponding metafied lowercase character.
|
||||
The behavior is undefined if \fIx\fP is already lowercase.
|
||||
that is bound to the corresponding metafied lowercase character.
|
||||
The behavior is undefined if \fIx\fP is already lowercase.
|
||||
.TP
|
||||
.B prefix\-meta (ESC)
|
||||
Metafy the next character typed.
|
||||
@@ -6759,7 +6751,6 @@ Display version information about the current instance of
|
||||
.BR bash .
|
||||
.PD
|
||||
.SS Programmable Completion
|
||||
.PP
|
||||
When word completion is attempted for an argument to a command for
|
||||
which a completion specification (a \fIcompspec\fP) has been defined
|
||||
using the \fBcomplete\fP builtin (see
|
||||
@@ -7077,7 +7068,6 @@ builtin below under
|
||||
.B "SHELL BUILTIN COMMANDS"
|
||||
for information on setting and unsetting shell options.
|
||||
.SH "HISTORY EXPANSION"
|
||||
.PP
|
||||
The shell supports a history expansion feature that
|
||||
is similar to the history expansion in
|
||||
.BR csh .
|
||||
@@ -7171,7 +7161,6 @@ The shell uses
|
||||
the history comment character to mark history timestamps when
|
||||
writing the history file.
|
||||
.SS Event Designators
|
||||
.PP
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
@@ -7225,7 +7214,6 @@ Equivalent to
|
||||
The entire command line typed so far.
|
||||
.PD
|
||||
.SS Word Designators
|
||||
.PP
|
||||
Word designators are used to select desired words from the event.
|
||||
A
|
||||
.B :
|
||||
@@ -7282,13 +7270,11 @@ If \fBx\fP is missing, it defaults to 0.
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
.SS Modifiers
|
||||
.PP
|
||||
After the optional word designator, there may appear a sequence of
|
||||
one or more of the following modifiers, each preceded by a `:'.
|
||||
These modify, or edit, the word or words selected from the history event.
|
||||
.PP
|
||||
.PD 0
|
||||
.PP
|
||||
.TP
|
||||
.B h
|
||||
Remove a trailing filename component, leaving only the head.
|
||||
@@ -10630,7 +10616,7 @@ option suppresses shell function lookup, as with the \fBcommand\fP builtin.
|
||||
returns true if all of the arguments are found, false if
|
||||
any are not found.
|
||||
.TP
|
||||
\fBulimit\fP [\fB\-HSabcdefiklmnpqrstuvxPT\fP [\fIlimit\fP]]
|
||||
\fBulimit\fP [\fB\-HSabcdefiklmnpqrstuvxPRT\fP [\fIlimit\fP]]
|
||||
Provides control over the resources available to the shell and to
|
||||
processes started by it, on systems that allow such control.
|
||||
The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
|
||||
@@ -10720,6 +10706,9 @@ The maximum number of file locks
|
||||
.B \-P
|
||||
The maximum number of pseudoterminals
|
||||
.TP
|
||||
.B \-R
|
||||
The maximum time a real-time process can run before blocking, in microseconds
|
||||
.TP
|
||||
.B \-T
|
||||
The maximum number of threads
|
||||
.PD
|
||||
@@ -10735,6 +10724,8 @@ If no option is given, then
|
||||
is assumed. Values are in 1024-byte increments, except for
|
||||
.BR \-t ,
|
||||
which is in seconds;
|
||||
.BR \-R ,
|
||||
which is in microseconds;
|
||||
.BR \-p ,
|
||||
which is in units of 512-byte blocks;
|
||||
.BR \-P ,
|
||||
@@ -11068,7 +11059,6 @@ Comments and bug reports concerning
|
||||
this manual page should be directed to
|
||||
.IR chet.ramey@case.edu .
|
||||
.SH BUGS
|
||||
.PP
|
||||
It's too big and too slow.
|
||||
.PP
|
||||
There are some subtle differences between
|
||||
|
||||
Binary file not shown.
+5713
-5651
File diff suppressed because it is too large
Load Diff
+48
-14
@@ -2311,6 +2311,15 @@ or information about @var{parameter} itself, depending on the value of
|
||||
@var{operator}. Each @var{operator} is a single letter:
|
||||
|
||||
@table @code
|
||||
@item U
|
||||
The expansion is a string that is the value of @var{parameter} with lowercase
|
||||
alphabetic characters converted to uppercase.
|
||||
@item u
|
||||
The expansion is a string that is the value of @var{parameter} with the first
|
||||
character converted to uppercase, if it is alphabetic.
|
||||
@item L
|
||||
The expansion is a string that is the value of @var{parameter} with uppercase
|
||||
alphabetic characters converted to lowercase.
|
||||
@item Q
|
||||
The expansion is a string that is the value of @var{parameter} quoted in a
|
||||
format that can be reused as input.
|
||||
@@ -2324,6 +2333,11 @@ The expansion is a string that is the result of expanding the value of
|
||||
The expansion is a string in the form of
|
||||
an assignment statement or @code{declare} command that, if
|
||||
evaluated, will recreate @var{parameter} with its attributes and value.
|
||||
@item K
|
||||
Produces a possibly-quoted version of the value of @var{parameter},
|
||||
except that it prints the values of
|
||||
indexed and associative arrays as a sequence of quoted key-value pairs
|
||||
(@pxref{Arrays}).
|
||||
@item a
|
||||
The expansion is a string consisting of flag values representing
|
||||
@var{parameter}'s attributes.
|
||||
@@ -4763,6 +4777,9 @@ The maximum number of file locks.
|
||||
@item -P
|
||||
The maximum number of pseudoterminals.
|
||||
|
||||
@item -R
|
||||
The maximum time a real-time process can run before blocking, in microseconds.
|
||||
|
||||
@item -T
|
||||
The maximum number of threads.
|
||||
@end table
|
||||
@@ -4779,8 +4796,10 @@ is printed, unless the @option{-H} option is supplied.
|
||||
When setting new limits, if neither @option{-H} nor @option{-S} is supplied,
|
||||
both the hard and soft limits are set.
|
||||
If no option is given, then @option{-f} is assumed. Values are in 1024-byte
|
||||
increments, except for @option{-t}, which is in seconds; @option{-p},
|
||||
which is in units of 512-byte blocks;
|
||||
increments, except for
|
||||
@option{-t}, which is in seconds;
|
||||
@option{-R}, which is in microseconds;
|
||||
@option{-p}, which is in units of 512-byte blocks;
|
||||
@option{-P},
|
||||
@option{-T},
|
||||
@option{-b},
|
||||
@@ -6272,9 +6291,13 @@ not already set.
|
||||
The process @sc{id} of the shell's parent process. This variable
|
||||
is readonly.
|
||||
|
||||
@item PROMPT_COMMAND
|
||||
If set, the value is interpreted as a command to execute
|
||||
before the printing of each primary prompt (@env{$PS1}).
|
||||
@item PROMPT_COMMANDS
|
||||
If this array variable is set,
|
||||
the value of each set element is interpreted as a command to execute
|
||||
before printing the primary prompt (@env{$PS1}).
|
||||
If this is not set, but
|
||||
@env{PROMPT_COMMAND}
|
||||
is set to a value, its value is used as a command to execute instead.
|
||||
|
||||
@item PROMPT_DIRTRIM
|
||||
If set to a number greater than zero, the value is used as the number of
|
||||
@@ -6283,7 +6306,7 @@ trailing directory components to retain when expanding the @code{\w} and
|
||||
Characters removed are replaced with an ellipsis.
|
||||
|
||||
@item PS0
|
||||
The value of this parameter is expanded like @var{PS1}
|
||||
The value of this parameter is expanded like @env{PS1}
|
||||
and displayed by interactive shells after reading a command
|
||||
and before the command is executed.
|
||||
|
||||
@@ -6820,8 +6843,8 @@ See @ref{Controlling the Prompt}, for a complete list of prompt
|
||||
string escape sequences.
|
||||
|
||||
@item
|
||||
Bash executes the value of the @env{PROMPT_COMMAND} variable as a command
|
||||
before printing the primary prompt, @env{$PS1}
|
||||
Bash executes the values of the set elements of the @env{PROMPT_COMMANDS}
|
||||
array variable as commands before printing the primary prompt, @env{$PS1}
|
||||
(@pxref{Bash Variables}).
|
||||
|
||||
@item
|
||||
@@ -7281,14 +7304,24 @@ Arrays are assigned to using compound assignments of the form
|
||||
@end example
|
||||
@noindent
|
||||
where each
|
||||
@var{value} is of the form @code{[@var{subscript}]=}@var{string}.
|
||||
@var{value} may be of the form @code{[@var{subscript}]=}@var{string}.
|
||||
Indexed array assignments do not require anything but @var{string}.
|
||||
When assigning to indexed arrays, if
|
||||
the optional subscript is supplied, that index is assigned to;
|
||||
otherwise the index of the element assigned is the last index assigned
|
||||
to by the statement plus one. Indexing starts at zero.
|
||||
|
||||
When assigning to an associative array, the subscript is required.
|
||||
When assigning to an associative array, the words in a compound assignment
|
||||
may be either assignment statements, for which the subscript is required,
|
||||
or a list of words that is interpreted as a sequence of alternating keys
|
||||
and values:
|
||||
@var{name}=(@var{key1} @var{value1} @var{key2} @var{value2} @dots{} ).
|
||||
These are treated identically to
|
||||
@var{name}=( [@var{key1}]=@var{value1} [@var{key2}]=@var{value2} @dots{} ).
|
||||
The first word in the list determines how the remaining words
|
||||
are interpreted; all assignments in a list must be of the same type.
|
||||
When using key/value pairs, the keys may not be missing or empty;
|
||||
a final missing value is treated like the empty string.
|
||||
|
||||
This syntax is also accepted by the @code{declare}
|
||||
builtin. Individual array elements may be assigned to using the
|
||||
@@ -7485,10 +7518,11 @@ to the @code{cd} builtin.
|
||||
@section Controlling the Prompt
|
||||
@cindex prompting
|
||||
|
||||
The value of the variable @env{PROMPT_COMMAND} is examined just before
|
||||
Bash prints each primary prompt. If @env{PROMPT_COMMAND} is set and
|
||||
has a non-null value, then the
|
||||
value is executed just as if it had been typed on the command line.
|
||||
Bash examines the value of the array variable @env{PROMPT_COMMANDS} just before
|
||||
printing each primary prompt.
|
||||
If any elements in @env{PROMPT_COMMANDS} are set and non-null, Bash
|
||||
executes each value, in numeric order,
|
||||
just as if it had been typed on the command line.
|
||||
|
||||
In addition, the following table describes the special characters which
|
||||
can appear in the prompt variables @env{PS0}, @env{PS1}, @env{PS2}, and
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2020 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Tue Mar 17 18:27:12 EDT 2020
|
||||
@set LASTCHANGE Tue Mar 24 16:38:56 EDT 2020
|
||||
|
||||
@set EDITION 5.0
|
||||
@set VERSION 5.0
|
||||
|
||||
@set UPDATED 17 March 2020
|
||||
@set UPDATED 24 March 2020
|
||||
@set UPDATED-MONTH March 2020
|
||||
|
||||
@@ -259,13 +259,39 @@ send_pwd_to_eterm ()
|
||||
free (f);
|
||||
}
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
void
|
||||
execute_array_command (ae, v)
|
||||
ARRAY_ELEMENT *ae;
|
||||
void *v;
|
||||
{
|
||||
char *tag, *command;
|
||||
|
||||
tag = (char *)v;
|
||||
command = element_value (ae);
|
||||
if (command && *command)
|
||||
execute_variable_command (command, tag);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
execute_prompt_command ()
|
||||
{
|
||||
char *command_to_execute;
|
||||
#if defined (ARRAY_VARS)
|
||||
SHELL_VAR *pcv;
|
||||
ARRAY *pcmds;
|
||||
|
||||
GET_ARRAY_FROM_VAR ("PROMPT_COMMANDS", pcv, pcmds);
|
||||
if (pcv && var_isset (pcv) && pcmds && array_num_elements (pcmds) > 0)
|
||||
{
|
||||
array_walk (pcmds, execute_array_command, "PROMPT_COMMANDS");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
command_to_execute = get_string_value ("PROMPT_COMMAND");
|
||||
if (command_to_execute)
|
||||
if (command_to_execute && *command_to_execute)
|
||||
execute_variable_command (command_to_execute, "PROMPT_COMMAND");
|
||||
}
|
||||
/* Call the YACC-generated parser and return the status of the parse.
|
||||
|
||||
+7
-21
@@ -562,7 +562,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
volatile int save_line_number;
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
volatile int ofifo, nfifo, osize, saved_fifo;
|
||||
volatile char *ofifo_list;
|
||||
volatile void *ofifo_list;
|
||||
#endif
|
||||
|
||||
if (breaking || continuing)
|
||||
@@ -751,12 +751,14 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
reap_procsubs ();
|
||||
# endif
|
||||
|
||||
if (variable_context != 0 || executing_list) /* XXX - also if sourcelevel != 0? */
|
||||
/* XXX - also if sourcelevel != 0? */
|
||||
if (variable_context != 0 || executing_list)
|
||||
{
|
||||
ofifo = num_fifos ();
|
||||
ofifo_list = copy_fifo_list ((int *)&osize);
|
||||
begin_unwind_frame ("internal_fifos");
|
||||
add_unwind_protect (xfree, ofifo_list);
|
||||
if (ofifo_list)
|
||||
add_unwind_protect (xfree, ofifo_list);
|
||||
saved_fifo = 1;
|
||||
}
|
||||
else
|
||||
@@ -1067,26 +1069,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
||||
{
|
||||
nfifo = num_fifos ();
|
||||
if (nfifo > ofifo)
|
||||
close_new_fifos ((char *)ofifo_list, osize);
|
||||
close_new_fifos ((void *)ofifo_list, osize);
|
||||
free ((void *)ofifo_list);
|
||||
discard_unwind_frame ("internal_fifos");
|
||||
}
|
||||
# if defined (HAVE_DEV_FD)
|
||||
/* Reap process substitutions at the end of loops */
|
||||
switch (command->type)
|
||||
{
|
||||
case cm_while:
|
||||
case cm_until:
|
||||
case cm_for:
|
||||
case cm_group:
|
||||
# if defined (ARITH_FOR_COMMAND)
|
||||
case cm_arith_for:
|
||||
# endif
|
||||
reap_procsubs ();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
# endif /* HAVE_DEV_FD */
|
||||
#endif
|
||||
|
||||
/* Invert the return value if we have to */
|
||||
@@ -5182,7 +5168,7 @@ execute_builtin_or_function (words, builtin, var, redirects,
|
||||
REDIRECT *saved_undo_list;
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
int ofifo, nfifo, osize;
|
||||
char *ofifo_list;
|
||||
void *ofifo_list;
|
||||
#endif
|
||||
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
|
||||
+20
-49
@@ -1323,12 +1323,7 @@ rl_redisplay (void)
|
||||
_rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
|
||||
#endif
|
||||
{
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
if (_rl_term_cr)
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
_rl_cr ();
|
||||
if (modmark)
|
||||
_rl_output_some_chars ("*", 1);
|
||||
|
||||
@@ -1962,11 +1957,7 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
|
||||
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
|
||||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
|
||||
{
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
_rl_cr ();
|
||||
if (modmark)
|
||||
_rl_output_some_chars ("*", 1);
|
||||
_rl_output_some_chars (local_prompt, lendiff);
|
||||
@@ -2420,11 +2411,7 @@ rl_clear_visible_line (void)
|
||||
int curr_line;
|
||||
|
||||
/* Make sure we move to column 0 so we clear the entire line */
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
_rl_cr ();
|
||||
_rl_last_c_pos = 0;
|
||||
|
||||
/* Move to the last screen line of the current visible line */
|
||||
@@ -2635,11 +2622,7 @@ _rl_move_cursor_relative (int new, const char *data)
|
||||
if (dpos == 0 || CR_FASTER (dpos, _rl_last_c_pos) ||
|
||||
(_rl_term_autowrap && i == _rl_screenwidth))
|
||||
{
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif /* !__MSDOS__ */
|
||||
_rl_cr ();
|
||||
cpos = _rl_last_c_pos = 0;
|
||||
}
|
||||
|
||||
@@ -2671,7 +2654,7 @@ _rl_move_cursor_relative (int new, const char *data)
|
||||
}
|
||||
else
|
||||
{
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
_rl_cr ();
|
||||
for (i = 0; i < new; i++)
|
||||
putc (data[i], rl_outstream);
|
||||
}
|
||||
@@ -2706,11 +2689,7 @@ _rl_move_vert (int to)
|
||||
{
|
||||
for (i = 0; i < delta; i++)
|
||||
putc ('\n', rl_outstream);
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
_rl_cr ();
|
||||
_rl_last_c_pos = 0;
|
||||
}
|
||||
else
|
||||
@@ -3051,14 +3030,18 @@ space_to_eol (int count)
|
||||
}
|
||||
|
||||
void
|
||||
_rl_clear_screen (void)
|
||||
_rl_clear_screen (int clrscr)
|
||||
{
|
||||
#if defined (__DJGPP__)
|
||||
ScreenClear ();
|
||||
ScreenSetCursor (0, 0);
|
||||
#else
|
||||
if (_rl_term_clrpag)
|
||||
tputs (_rl_term_clrpag, 1, _rl_output_character_function);
|
||||
{
|
||||
tputs (_rl_term_clrpag, 1, _rl_output_character_function);
|
||||
if (clrscr && _rl_term_clrscroll)
|
||||
tputs (_rl_term_clrscroll, 1, _rl_output_character_function);
|
||||
}
|
||||
else
|
||||
rl_crlf ();
|
||||
#endif /* __DJGPP__ */
|
||||
@@ -3177,15 +3160,8 @@ _rl_update_final (void)
|
||||
static void
|
||||
cr (void)
|
||||
{
|
||||
if (_rl_term_cr)
|
||||
{
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
_rl_last_c_pos = 0;
|
||||
}
|
||||
_rl_cr ();
|
||||
_rl_last_c_pos = 0;
|
||||
}
|
||||
|
||||
/* Redraw the last line of a multi-line prompt that may possibly contain
|
||||
@@ -3228,24 +3204,19 @@ _rl_redisplay_after_sigwinch (void)
|
||||
{
|
||||
_rl_move_vert (_rl_vis_botlin);
|
||||
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
_rl_cr ();
|
||||
_rl_last_c_pos = 0;
|
||||
#if defined (__MSDOS__)
|
||||
space_to_eol (_rl_screenwidth);
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
|
||||
#if !defined (__MSDOS__)
|
||||
if (_rl_term_clreol)
|
||||
tputs (_rl_term_clreol, 1, _rl_output_character_function);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
space_to_eol (_rl_screenwidth);
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
_rl_cr ();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_rl_last_v_pos > 0)
|
||||
_rl_move_vert (0);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
.SH NAME
|
||||
history \- GNU History Library
|
||||
.SH COPYRIGHT
|
||||
.if t The GNU History Library is Copyright \(co 1989-2017 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2017 by the Free Software Foundation, Inc.
|
||||
.if t The GNU History Library is Copyright \(co 1989-2020 by the Free Software Foundation, Inc.
|
||||
.if n The GNU History Library is Copyright (C) 1989-2020 by the Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
Many programs read input from the user a line at a time. The GNU
|
||||
History library is able to keep track of those lines, associate arbitrary
|
||||
@@ -49,7 +49,6 @@ data with each line, and utilize information from previous lines in
|
||||
composing new ones.
|
||||
.PP
|
||||
.SH "HISTORY EXPANSION"
|
||||
.PP
|
||||
The history library supports a history expansion feature that
|
||||
is identical to the history expansion in
|
||||
.BR bash.
|
||||
@@ -80,7 +79,6 @@ history expansion character, which is \^\fB!\fP\^ by default.
|
||||
Only backslash (\^\fB\e\fP\^) and single quotes can quote
|
||||
the history expansion character.
|
||||
.SS Event Designators
|
||||
.PP
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
Unless the reference is absolute, events are relative to the current
|
||||
@@ -134,7 +132,6 @@ Equivalent to
|
||||
The entire command line typed so far.
|
||||
.PD
|
||||
.SS Word Designators
|
||||
.PP
|
||||
Word designators are used to select desired words from the event.
|
||||
A
|
||||
.B :
|
||||
@@ -191,7 +188,6 @@ If \fBx\fP is missing, it defaults to 0.
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
.SS Modifiers
|
||||
.PP
|
||||
After the optional word designator, there may appear a sequence of
|
||||
one or more of the following modifiers, each preceded by a `:'.
|
||||
These modify, or edit, the word or words selected from the history event.
|
||||
@@ -280,7 +276,6 @@ in the event line.
|
||||
.SH "PROGRAMMING WITH HISTORY FUNCTIONS"
|
||||
This section describes how to use the History library in other programs.
|
||||
.SS Introduction to History
|
||||
.PP
|
||||
The programmer using the History library has available functions
|
||||
for remembering lines on a history list, associating arbitrary data
|
||||
with a line, removing lines from the list, searching through the list
|
||||
@@ -308,9 +303,7 @@ in any file that uses the
|
||||
History library's features. It supplies extern declarations for all
|
||||
of the library's public functions and variables, and declares all of
|
||||
the public data structures.
|
||||
|
||||
.SS History Storage
|
||||
.PP
|
||||
The history list is an array of history entries. A history entry is
|
||||
declared as follows:
|
||||
.PP
|
||||
@@ -346,7 +339,6 @@ typedef struct _hist_state {
|
||||
If the flags member includes \fBHS_STIFLED\fP, the history has been
|
||||
stifled.
|
||||
.SH "History Functions"
|
||||
.PP
|
||||
This section describes the calling sequence for the various functions
|
||||
exported by the GNU History library.
|
||||
.SS Initializing History and State Management
|
||||
@@ -365,7 +357,6 @@ Return a structure describing the current state of the input history.
|
||||
Set the state of the history list according to \fIstate\fP.
|
||||
|
||||
.SS History List Management
|
||||
|
||||
These functions manage individual entries on the history list, or set
|
||||
parameters managing the list itself.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ This document describes the GNU History library
|
||||
a programming tool that provides a consistent user interface for
|
||||
recalling lines of previously typed input.
|
||||
|
||||
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988--2018 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2020 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
|
||||
+13
-19
@@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Mon Nov 25 10:53:27 EST 2019
|
||||
.\" Last Change: Tue Mar 24 09:27:30 EDT 2020
|
||||
.\"
|
||||
.TH READLINE 3 "2019 November 25" "GNU Readline 8.0"
|
||||
.TH READLINE 3 "2020 March 24" "GNU Readline 8.0"
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@@ -34,8 +34,8 @@ readline \- get a line from a user with editing
|
||||
\fBreadline\fP (\fIconst char *prompt\fP);
|
||||
.fi
|
||||
.SH COPYRIGHT
|
||||
.if n Readline is Copyright (C) 1989\-2014 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2014 Free Software Foundation, Inc.
|
||||
.if n Readline is Copyright (C) 1989\-2020 Free Software Foundation, Inc.
|
||||
.if t Readline is Copyright \(co 1989\-2020 Free Software Foundation, Inc.
|
||||
.SH DESCRIPTION
|
||||
.LP
|
||||
.B readline
|
||||
@@ -163,7 +163,6 @@ In addition to command names, readline allows keys to be bound
|
||||
to a string that is inserted when the key is pressed (a \fImacro\fP).
|
||||
.PP
|
||||
.SS Key Bindings
|
||||
.PP
|
||||
The syntax for controlling key bindings in the
|
||||
.I inputrc
|
||||
file is simple. All that is required is the name of the
|
||||
@@ -318,7 +317,6 @@ similar mechanisms. The
|
||||
file may be edited and re-read if a program does not provide
|
||||
any other means to incorporate new bindings.
|
||||
.SS Variables
|
||||
.PP
|
||||
Readline has variables that can be used to further customize its
|
||||
behavior. A variable may be set in the
|
||||
.I inputrc
|
||||
@@ -634,7 +632,6 @@ by \fIstat\fP(2) is appended to the filename when listing possible
|
||||
completions.
|
||||
.PD
|
||||
.SS Conditional Constructs
|
||||
.PP
|
||||
Readline implements a facility similar in spirit to the conditional
|
||||
compilation features of the C preprocessor which allows key
|
||||
bindings and variable settings to be performed as the result
|
||||
@@ -732,7 +729,6 @@ would read \fI/etc/inputrc\fP:
|
||||
.fi
|
||||
.RE
|
||||
.SH SEARCHING
|
||||
.PP
|
||||
Readline provides commands for searching through the command history
|
||||
for lines containing a specified string.
|
||||
There are two search modes:
|
||||
@@ -772,7 +768,6 @@ Non-incremental searches read the entire search string before starting
|
||||
to search for matching history lines. The search string may be
|
||||
typed by the user or be part of the contents of the current line.
|
||||
.SH EDITING COMMANDS
|
||||
.PP
|
||||
The following is a list of the names of the commands and the default
|
||||
key sequences to which they are bound.
|
||||
Command names without an accompanying key sequence are unbound by default.
|
||||
@@ -782,7 +777,6 @@ position, and \fImark\fP refers to a cursor position saved by the
|
||||
\fBset\-mark\fP command.
|
||||
The text between the point and mark is referred to as the \fIregion\fP.
|
||||
.SS Commands for Moving
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B beginning\-of\-line (C\-a)
|
||||
@@ -818,8 +812,15 @@ Readline line does not take up more than one physical line or if the length
|
||||
of the current Readline line is not greater than the length of the prompt
|
||||
plus the screen width.
|
||||
.TP
|
||||
.B clear\-display (M\-C\-l)
|
||||
Clear the screen and, if possible, the terminal's scrollback buffer,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
.TP
|
||||
.B clear\-screen (C\-l)
|
||||
Clear the screen leaving the current line at the top of the screen.
|
||||
Clear the screen,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
With an argument, refresh the current line without clearing the
|
||||
screen.
|
||||
.TP
|
||||
@@ -827,7 +828,6 @@ screen.
|
||||
Refresh the current line.
|
||||
.PD
|
||||
.SS Commands for Manipulating the History
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B accept\-line (Newline, Return)
|
||||
@@ -920,7 +920,6 @@ The history expansion facilities are used to extract the last argument,
|
||||
as if the "!$" history expansion had been specified.
|
||||
.PD
|
||||
.SS Commands for Changing Text
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B \fIend\-of\-file\fP (usually C\-d)
|
||||
@@ -995,7 +994,6 @@ Characters bound to \fBbackward\-delete\-char\fP replace the character
|
||||
before point with a space. By default, this command is unbound.
|
||||
.PD
|
||||
.SS Killing and Yanking
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B kill\-line (C\-k)
|
||||
@@ -1058,7 +1056,6 @@ or
|
||||
.BR yank\-pop .
|
||||
.PD
|
||||
.SS Numeric Arguments
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B digit\-argument (M\-0, M\-1, ..., M\-\-)
|
||||
@@ -1080,7 +1077,6 @@ first time makes the argument count four, a second time makes the
|
||||
argument count sixteen, and so on.
|
||||
.PD
|
||||
.SS Completing
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B complete (TAB)
|
||||
@@ -1137,7 +1133,6 @@ If at the end of the line, behaves identically to
|
||||
\fBpossible-completions\fP.
|
||||
.PD
|
||||
.SS Keyboard Macros
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B start\-kbd\-macro (C\-x (\^)
|
||||
@@ -1156,7 +1151,6 @@ Print the last keyboard macro defined in a format suitable for the
|
||||
\fIinputrc\fP file.
|
||||
.PD
|
||||
.SS Miscellaneous
|
||||
.PP
|
||||
.PD 0
|
||||
.TP
|
||||
.B re\-read\-init\-file (C\-x C\-r)
|
||||
@@ -1332,6 +1326,7 @@ Emacs Meta bindings
|
||||
"M-C-H" backward-kill-word
|
||||
"M-C-I" tab-insert
|
||||
"M-C-J" vi-editing-mode
|
||||
"M-C-L" clear-display
|
||||
"M-C-M" vi-editing-mode
|
||||
"M-C-R" revert-line
|
||||
"M-C-Y" yank-nth-arg
|
||||
@@ -1536,5 +1531,4 @@ Comments and bug reports concerning
|
||||
this manual page should be directed to
|
||||
.IR chet.ramey@case.edu .
|
||||
.SH BUGS
|
||||
.PP
|
||||
It's too big and too slow.
|
||||
|
||||
@@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Copyright (C) 1988--2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2020 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
||||
@@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo"
|
||||
which contains both end-user and programmer documentation for the
|
||||
GNU Readline Library.
|
||||
|
||||
Copyright (C) 1988--2016 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988--2020 Free Software Foundation, Inc.
|
||||
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
@@ -1201,8 +1201,14 @@ Readline line does not take up more than one physical line or if the length
|
||||
of the current Readline line is not greater than the length of the prompt
|
||||
plus the screen width.
|
||||
|
||||
@item clear-display (M-C-l)
|
||||
Clear the screen and, if possible, the terminal's scrollback buffer,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
|
||||
@item clear-screen (C-l)
|
||||
Clear the screen and redraw the current line,
|
||||
Clear the screen,
|
||||
then redraw the current line,
|
||||
leaving the current line at the top of the screen.
|
||||
|
||||
@item redraw-current-line ()
|
||||
|
||||
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@ignore
|
||||
Copyright (C) 1988-2019 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2020 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set EDITION 8.0
|
||||
@set VERSION 8.0
|
||||
@set UPDATED 25 November 2019
|
||||
@set UPDATED-MONTH November 2019
|
||||
@set UPDATED 24 March 2020
|
||||
@set UPDATED-MONTH March 2020
|
||||
|
||||
@set LASTCHANGE Mon Nov 25 10:53:13 EST 2019
|
||||
@set LASTCHANGE Tue Mar 24 09:28:28 EDT 2020
|
||||
|
||||
@@ -327,7 +327,7 @@ KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
|
||||
{ ISFUNC, rl_tab_insert }, /* Meta-Control-i */
|
||||
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-k */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-l */
|
||||
{ ISFUNC, rl_clear_display }, /* Meta-Control-l */
|
||||
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-n */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-o */
|
||||
|
||||
@@ -73,6 +73,7 @@ static const FUNMAP default_funmap[] = {
|
||||
{ "capitalize-word", rl_capitalize_word },
|
||||
{ "character-search", rl_char_search },
|
||||
{ "character-search-backward", rl_backward_char_search },
|
||||
{ "clear-display", rl_clear_display },
|
||||
{ "clear-screen", rl_clear_screen },
|
||||
{ "complete", rl_complete },
|
||||
{ "copy-backward-word", rl_copy_backward_word },
|
||||
|
||||
@@ -727,7 +727,9 @@ rl_bracketed_paste_begin (int count, int key)
|
||||
char *buf;
|
||||
|
||||
buf = _rl_bracketed_text (&len);
|
||||
rl_mark = rl_point;
|
||||
retval = rl_insert_text (buf) == len ? 0 : 1;
|
||||
rl_activate_mark ();
|
||||
|
||||
xfree (buf);
|
||||
return (retval);
|
||||
|
||||
@@ -417,6 +417,8 @@ readline_internal_setup (void)
|
||||
if (rl_startup_hook)
|
||||
(*rl_startup_hook) ();
|
||||
|
||||
rl_deactivate_mark ();
|
||||
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
|
||||
@@ -638,6 +640,11 @@ readline_internal_charloop (void)
|
||||
if (rl_pending_input == 0 && lk == _rl_last_command_was_kill)
|
||||
_rl_last_command_was_kill = 0;
|
||||
|
||||
if (_rl_keep_mark_active)
|
||||
_rl_keep_mark_active = 0;
|
||||
else if (rl_mark_active_p ())
|
||||
rl_deactivate_mark ();
|
||||
|
||||
_rl_internal_char_cleanup ();
|
||||
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
@@ -1458,5 +1465,7 @@ rl_restore_state (struct readline_state *sp)
|
||||
rl_attempted_completion_function = sp->attemptfunc;
|
||||
rl_completer_word_break_characters = sp->wordbreakchars;
|
||||
|
||||
rl_deactivate_mark ();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ extern int rl_forward_word PARAMS((int, int));
|
||||
extern int rl_backward_word PARAMS((int, int));
|
||||
extern int rl_refresh_line PARAMS((int, int));
|
||||
extern int rl_clear_screen PARAMS((int, int));
|
||||
extern int rl_clear_display PARAMS((int, int));
|
||||
extern int rl_skip_csi_sequence PARAMS((int, int));
|
||||
extern int rl_arrow_keys PARAMS((int, int));
|
||||
|
||||
@@ -392,6 +393,14 @@ extern int rl_clear_message PARAMS((void));
|
||||
extern int rl_reset_line_state PARAMS((void));
|
||||
extern int rl_crlf PARAMS((void));
|
||||
|
||||
/* Functions to manage the mark and region, especially the notion of an
|
||||
active mark and an active region. */
|
||||
extern void rl_keep_mark_active PARAMS((void));
|
||||
|
||||
extern void rl_activate_mark PARAMS((void));
|
||||
extern void rl_deactivate_mark PARAMS((void));
|
||||
extern int rl_mark_active_p PARAMS((void));
|
||||
|
||||
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
|
||||
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
|
||||
#else
|
||||
|
||||
@@ -274,7 +274,7 @@ extern void _rl_restore_prompt PARAMS((void));
|
||||
extern char *_rl_make_prompt_for_search PARAMS((int));
|
||||
extern void _rl_erase_at_end_of_line PARAMS((int));
|
||||
extern void _rl_clear_to_eol PARAMS((int));
|
||||
extern void _rl_clear_screen PARAMS((void));
|
||||
extern void _rl_clear_screen PARAMS((int));
|
||||
extern void _rl_update_final PARAMS((void));
|
||||
extern void _rl_optimize_redisplay PARAMS((void));
|
||||
extern void _rl_redisplay_after_sigwinch PARAMS((void));
|
||||
@@ -378,6 +378,7 @@ extern void _rl_output_character_function PARAMS((int));
|
||||
#else
|
||||
extern int _rl_output_character_function PARAMS((int));
|
||||
#endif
|
||||
extern void _rl_cr PARAMS((void));
|
||||
extern void _rl_output_some_chars PARAMS((const char *, int));
|
||||
extern int _rl_backspace PARAMS((int));
|
||||
extern void _rl_enable_meta_key PARAMS((void));
|
||||
@@ -565,6 +566,7 @@ extern int _rl_term_autowrap;
|
||||
|
||||
/* text.c */
|
||||
extern int _rl_optimize_typeahead;
|
||||
extern int _rl_keep_mark_active;
|
||||
|
||||
/* undo.c */
|
||||
extern int _rl_doing_an_undo;
|
||||
|
||||
+19
-1
@@ -152,6 +152,10 @@ static int term_has_meta;
|
||||
static char *_rl_term_mm;
|
||||
static char *_rl_term_mo;
|
||||
|
||||
/* The sequences to enter and exit standout mode. */
|
||||
static char *_rl_term_so;
|
||||
static char *_rl_term_se;
|
||||
|
||||
/* The key sequences output by the arrow keys, if this terminal has any. */
|
||||
static char *_rl_term_ku;
|
||||
static char *_rl_term_kd;
|
||||
@@ -423,6 +427,8 @@ static const struct _tc_string tc_strings[] =
|
||||
{ "mo", &_rl_term_mo },
|
||||
{ "nd", &_rl_term_forward_char },
|
||||
{ "pc", &_rl_term_pc },
|
||||
{ "se", &_rl_term_se },
|
||||
{ "so", &_rl_term_so },
|
||||
{ "up", &_rl_term_up },
|
||||
{ "vb", &_rl_visible_bell },
|
||||
{ "vs", &_rl_term_vs },
|
||||
@@ -470,6 +476,7 @@ _rl_init_terminal_io (const char *terminal_name)
|
||||
_rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
|
||||
_rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
|
||||
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
|
||||
_rl_term_so = _rl_term_se = (char *)NULL;
|
||||
#if defined(HACK_TERMCAP_MOTION)
|
||||
_rl_term_forward_char = (char *)NULL;
|
||||
#endif
|
||||
@@ -534,6 +541,7 @@ _rl_init_terminal_io (const char *terminal_name)
|
||||
_rl_term_mm = _rl_term_mo = (char *)NULL;
|
||||
_rl_term_ve = _rl_term_vs = (char *)NULL;
|
||||
_rl_term_forward_char = (char *)NULL;
|
||||
_rl_term_so = _rl_term_se = (char *)NULL;
|
||||
_rl_terminal_can_insert = term_has_meta = 0;
|
||||
|
||||
/* Reasonable defaults for tgoto(). Readline currently only uses
|
||||
@@ -554,7 +562,7 @@ _rl_init_terminal_io (const char *terminal_name)
|
||||
BC = _rl_term_backspace;
|
||||
UP = _rl_term_up;
|
||||
|
||||
if (!_rl_term_cr)
|
||||
if (_rl_term_cr == 0)
|
||||
_rl_term_cr = "\r";
|
||||
|
||||
_rl_term_autowrap = TGETFLAG ("am") && TGETFLAG ("xn");
|
||||
@@ -689,6 +697,16 @@ rl_crlf (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_cr (void)
|
||||
{
|
||||
#if defined (__MSDOS__)
|
||||
putc ('\r', rl_outstream);
|
||||
#else
|
||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Ring the terminal bell. */
|
||||
int
|
||||
rl_ding (void)
|
||||
|
||||
+59
-3
@@ -1,6 +1,6 @@
|
||||
/* text.c -- text handling commands for readline. */
|
||||
|
||||
/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -607,7 +607,18 @@ rl_clear_screen (int count, int key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
_rl_clear_screen (); /* calls termcap function to clear screen */
|
||||
_rl_clear_screen (0); /* calls termcap function to clear screen */
|
||||
rl_keep_mark_active ();
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_clear_display (int count, int key)
|
||||
{
|
||||
_rl_clear_screen (1); /* calls termcap function to clear screen and scrollback buffer */
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
@@ -1091,6 +1102,15 @@ rl_tab_insert (int count, int key)
|
||||
int
|
||||
rl_newline (int count, int key)
|
||||
{
|
||||
if (rl_mark_active_p ())
|
||||
{
|
||||
rl_deactivate_mark ();
|
||||
#if 0 /* Not yet */
|
||||
(*rl_redisplay_function) ();
|
||||
_rl_want_redisplay = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
rl_done = 1;
|
||||
|
||||
if (_rl_history_preserve_point)
|
||||
@@ -1830,7 +1850,43 @@ rl_exchange_point_and_mark (int count, int key)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
SWAP (rl_point, rl_mark);
|
||||
{
|
||||
SWAP (rl_point, rl_mark);
|
||||
rl_activate_mark ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Active mark support */
|
||||
|
||||
/* Is the region active? */
|
||||
static int mark_active = 0;
|
||||
|
||||
/* Does the current command want the mark to remain active when it completes? */
|
||||
int _rl_keep_mark_active;
|
||||
|
||||
void
|
||||
rl_keep_mark_active (void)
|
||||
{
|
||||
_rl_keep_mark_active++;
|
||||
}
|
||||
|
||||
void
|
||||
rl_activate_mark (void)
|
||||
{
|
||||
mark_active = 1;
|
||||
rl_keep_mark_active ();
|
||||
}
|
||||
|
||||
void
|
||||
rl_deactivate_mark (void)
|
||||
{
|
||||
mark_active = 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_mark_active_p (void)
|
||||
{
|
||||
return (mark_active);
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ _rl_abort_internal (void)
|
||||
rl_clear_message ();
|
||||
_rl_reset_argument ();
|
||||
rl_clear_pending_input ();
|
||||
rl_deactivate_mark ();
|
||||
|
||||
while (rl_executing_macro)
|
||||
_rl_pop_executing_macro ();
|
||||
|
||||
@@ -291,7 +291,7 @@ static char *parameter_brace_remove_pattern PARAMS((char *, char *, int, char *,
|
||||
|
||||
static char *string_var_assignment PARAMS((SHELL_VAR *, char *));
|
||||
#if defined (ARRAY_VARS)
|
||||
static char *array_var_assignment PARAMS((SHELL_VAR *, int, int));
|
||||
static char *array_var_assignment PARAMS((SHELL_VAR *, int, int, int));
|
||||
#endif
|
||||
static char *pos_params_assignment PARAMS((WORD_LIST *, int, int));
|
||||
static char *string_transform PARAMS((int, SHELL_VAR *, char *));
|
||||
@@ -5389,13 +5389,13 @@ clear_fifo_list ()
|
||||
nfifo = 0;
|
||||
}
|
||||
|
||||
char *
|
||||
void *
|
||||
copy_fifo_list (sizep)
|
||||
int *sizep;
|
||||
{
|
||||
if (sizep)
|
||||
*sizep = 0;
|
||||
return (char *)NULL;
|
||||
return (void *)NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -5461,8 +5461,13 @@ unlink_fifo_list ()
|
||||
for (i = j = 0; i < nfifo; i++)
|
||||
if (fifo_list[i].file)
|
||||
{
|
||||
fifo_list[j].file = fifo_list[i].file;
|
||||
fifo_list[j].proc = fifo_list[i].proc;
|
||||
if (i != j)
|
||||
{
|
||||
fifo_list[j].file = fifo_list[i].file;
|
||||
fifo_list[j].proc = fifo_list[i].proc;
|
||||
fifo_list[i].file = (char *)NULL;
|
||||
fifo_list[i].proc = 0;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
nfifo = j;
|
||||
@@ -5478,10 +5483,11 @@ unlink_fifo_list ()
|
||||
case it's larger than fifo_list_size (size of fifo_list). */
|
||||
void
|
||||
close_new_fifos (list, lsize)
|
||||
char *list;
|
||||
void *list;
|
||||
int lsize;
|
||||
{
|
||||
int i;
|
||||
char *plist;
|
||||
|
||||
if (list == 0)
|
||||
{
|
||||
@@ -5489,8 +5495,8 @@ close_new_fifos (list, lsize)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < lsize; i++)
|
||||
if (list[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
|
||||
for (plist = (char *)list, i = 0; i < lsize; i++)
|
||||
if (plist[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
|
||||
unlink_fifo (i);
|
||||
|
||||
for (i = lsize; i < fifo_list_size; i++)
|
||||
@@ -5623,22 +5629,22 @@ clear_fifo_list ()
|
||||
nfds = 0;
|
||||
}
|
||||
|
||||
char *
|
||||
void *
|
||||
copy_fifo_list (sizep)
|
||||
int *sizep;
|
||||
{
|
||||
char *ret;
|
||||
void *ret;
|
||||
|
||||
if (nfds == 0 || totfds == 0)
|
||||
{
|
||||
if (sizep)
|
||||
*sizep = 0;
|
||||
return (char *)NULL;
|
||||
return (void *)NULL;
|
||||
}
|
||||
|
||||
if (sizep)
|
||||
*sizep = totfds;
|
||||
ret = (char *)xmalloc (totfds * sizeof (pid_t));
|
||||
ret = xmalloc (totfds * sizeof (pid_t));
|
||||
return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t)));
|
||||
}
|
||||
|
||||
@@ -5711,10 +5717,11 @@ unlink_fifo_list ()
|
||||
totfds (size of dev_fd_list). */
|
||||
void
|
||||
close_new_fifos (list, lsize)
|
||||
char *list;
|
||||
void *list;
|
||||
int lsize;
|
||||
{
|
||||
int i;
|
||||
pid_t *plist;
|
||||
|
||||
if (list == 0)
|
||||
{
|
||||
@@ -5722,8 +5729,8 @@ close_new_fifos (list, lsize)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < lsize; i++)
|
||||
if (list[i] == 0 && i < totfds && dev_fd_list[i])
|
||||
for (plist = (pid_t *)list, i = 0; i < lsize; i++)
|
||||
if (plist[i] == 0 && i < totfds && dev_fd_list[i])
|
||||
unlink_fifo (i);
|
||||
|
||||
for (i = lsize; i < totfds; i++)
|
||||
@@ -7634,17 +7641,21 @@ string_var_assignment (v, s)
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
static char *
|
||||
array_var_assignment (v, itype, quoted)
|
||||
array_var_assignment (v, itype, quoted, atype)
|
||||
SHELL_VAR *v;
|
||||
int itype, quoted;
|
||||
int itype, quoted, atype;
|
||||
{
|
||||
char *ret, *val, flags[MAX_ATTRIBUTES];
|
||||
int i;
|
||||
|
||||
if (v == 0)
|
||||
return (char *)NULL;
|
||||
val = array_p (v) ? array_to_assign (array_cell (v), 0)
|
||||
: assoc_to_assign (assoc_cell (v), 0);
|
||||
if (atype == 2)
|
||||
val = array_p (v) ? array_to_kvpair (array_cell (v), 0)
|
||||
: assoc_to_kvpair (assoc_cell (v), 0);
|
||||
else
|
||||
val = array_p (v) ? array_to_assign (array_cell (v), 0)
|
||||
: assoc_to_assign (assoc_cell (v), 0);
|
||||
|
||||
if (val == 0 && (invisible_p (v) || var_isset (v) == 0))
|
||||
; /* placeholder */
|
||||
@@ -7661,6 +7672,10 @@ array_var_assignment (v, itype, quoted)
|
||||
free (val);
|
||||
val = ret;
|
||||
}
|
||||
|
||||
if (atype == 2)
|
||||
return val;
|
||||
|
||||
i = var_attribute_string (v, 0, flags);
|
||||
ret = (char *)xmalloc (i + STRLEN (val) + strlen (v->name) + 16);
|
||||
if (val)
|
||||
@@ -7713,6 +7728,9 @@ string_transform (xc, v, s)
|
||||
case 'A':
|
||||
ret = string_var_assignment (v, s);
|
||||
break;
|
||||
case 'K':
|
||||
ret = sh_quote_reusable (s, 0);
|
||||
break;
|
||||
/* Transformations that modify the variable's value */
|
||||
case 'E':
|
||||
t = ansiexpand (s, 0, strlen (s), (int *)0);
|
||||
@@ -7725,6 +7743,15 @@ string_transform (xc, v, s)
|
||||
case 'Q':
|
||||
ret = sh_quote_reusable (s, 0);
|
||||
break;
|
||||
case 'U':
|
||||
ret = sh_modcase (s, 0, CASE_UPPER);
|
||||
break;
|
||||
case 'u':
|
||||
ret = sh_modcase (s, 0, CASE_UPFIRST); /* capitalize */
|
||||
break;
|
||||
case 'L':
|
||||
ret = sh_modcase (s, 0, CASE_LOWER);
|
||||
break;
|
||||
default:
|
||||
ret = (char *)NULL;
|
||||
break;
|
||||
@@ -7805,7 +7832,9 @@ array_transform (xc, var, starsub, quoted)
|
||||
itype = starsub ? '*' : '@';
|
||||
|
||||
if (xc == 'A')
|
||||
return (array_var_assignment (v, itype, quoted));
|
||||
return (array_var_assignment (v, itype, quoted, 1));
|
||||
else if (xc == 'K')
|
||||
return (array_var_assignment (v, itype, quoted, 2));
|
||||
|
||||
/* special case for unset arrays and attributes */
|
||||
if (xc == 'a' && (invisible_p (v) || var_isset (v) == 0))
|
||||
@@ -7860,9 +7889,13 @@ parameter_brace_transform (varname, value, ind, xform, rtype, quoted, pflags, fl
|
||||
{
|
||||
case 'a': /* expand to a string with just attributes */
|
||||
case 'A': /* expand as an assignment statement with attributes */
|
||||
case 'K': /* expand assoc array to list of key/value pairs */
|
||||
case 'E': /* expand like $'...' */
|
||||
case 'P': /* expand like prompt string */
|
||||
case 'Q': /* quote reusably */
|
||||
case 'U': /* transform to uppercase */
|
||||
case 'u': /* tranform by capitalizing */
|
||||
case 'L': /* transform to lowercase */
|
||||
break;
|
||||
default:
|
||||
this_command_name = oname;
|
||||
@@ -8108,7 +8141,7 @@ pat_subst (string, pat, rep, mflags)
|
||||
|
||||
mtype = mflags & MATCH_TYPEMASK;
|
||||
|
||||
#if 0 /* bash-4.2 ? */
|
||||
#if 0 /* TAG: bash-5.2? */
|
||||
rxpand = (rep && *rep) ? shouldexp_replacement (rep) : 0;
|
||||
#else
|
||||
rxpand = 0;
|
||||
|
||||
@@ -272,9 +272,8 @@ extern int num_fifos PARAMS((void));
|
||||
extern void unlink_fifo_list PARAMS((void));
|
||||
extern void unlink_fifo PARAMS((int));
|
||||
|
||||
extern char *copy_fifo_list PARAMS((int *));
|
||||
extern void unlink_new_fifos PARAMS((char *, int));
|
||||
extern void close_new_fifos PARAMS((char *, int));
|
||||
extern void *copy_fifo_list PARAMS((int *));
|
||||
extern void close_new_fifos PARAMS((void *, int));
|
||||
|
||||
extern void clear_fifo_list PARAMS((void));
|
||||
|
||||
|
||||
+5
-13
@@ -442,17 +442,13 @@ declare -a foo=([0]="[0]=bar")
|
||||
declare -a foo=([0]="[0]=bar")
|
||||
declare -- a="(1 2 3)"
|
||||
declare -a a=([0]="1" [1]="2" [2]="3")
|
||||
./array19.sub: line 59: a: 1: must use subscript when assigning associative array
|
||||
./array19.sub: line 59: a: 2: must use subscript when assigning associative array
|
||||
./array19.sub: line 59: a: 3: must use subscript when assigning associative array
|
||||
declare -A a=()
|
||||
declare -- a="([0]=a [1]=b)"
|
||||
declare -a a=([0]="a" [1]="b")
|
||||
declare -A a=([1]="b" [0]="a" )
|
||||
declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
|
||||
declare -a var=([0]="[\$(echo total 0)]=1 [2]=2]")
|
||||
declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
|
||||
./array19.sub: line 94: total 0: syntax error in expression (error token is "0")
|
||||
./array19.sub: line 89: total 0: syntax error in expression (error token is "0")
|
||||
declare -a var=()
|
||||
declare -al foo=([0]="abcde" [1]="two" [2]="three")
|
||||
declare -al foo=([0]="abcde")
|
||||
@@ -460,7 +456,7 @@ declare -al ar=([0]="one" [1]="two" [2]="three")
|
||||
declare -a a=([2]="foo")
|
||||
declare -a a=([2]="foo")
|
||||
declare -a a=([1]="(var)" [2]="foo")
|
||||
./array19.sub: line 133: warning: a[1]=(var): quoted compound array assignment deprecated
|
||||
./array19.sub: line 128: warning: a[1]=(var): quoted compound array assignment deprecated
|
||||
declare -a a=([1]="(var)")
|
||||
declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
|
||||
declare -a a=([0]="1" [1]="2" [2]="(1 2 3)")
|
||||
@@ -477,15 +473,11 @@ declare -a b=([0]="/scratch/bash")
|
||||
declare -a c=([0]="1" [1]="2")
|
||||
declare -a d=([0]="a" [1]="b")
|
||||
declare -a e=([0]="Darwin")
|
||||
./array19.sub: line 179: c: 1: must use subscript when assigning associative array
|
||||
./array19.sub: line 179: c: 2: must use subscript when assigning associative array
|
||||
./array19.sub: line 179: d: $a: must use subscript when assigning associative array
|
||||
./array19.sub: line 179: e: $(echo Darwin): must use subscript when assigning associative array
|
||||
declare -A a=([0]="a b" )
|
||||
declare -A b=([0]="/scratch/bash" )
|
||||
declare -A c=()
|
||||
declare -A d=()
|
||||
declare -A e=()
|
||||
declare -A c=([1]="2" )
|
||||
declare -A d=(["a b"]="" )
|
||||
declare -A e=([Darwin]="" )
|
||||
a+b+c
|
||||
x+b+c
|
||||
a+b+c
|
||||
|
||||
@@ -55,11 +55,6 @@ declare a='(1 2 3)'
|
||||
declare -p a
|
||||
unset a
|
||||
|
||||
declare -A a
|
||||
declare a='(1 2 3)'
|
||||
declare -p a
|
||||
unset a
|
||||
|
||||
declare a='([0]=a [1]=b)'
|
||||
declare -p a
|
||||
unset a
|
||||
|
||||
@@ -231,3 +231,21 @@ f: declare -a a
|
||||
main: declare -- a="7"
|
||||
f: declare -A a
|
||||
main: declare -- a="42"
|
||||
declare -A a=([3]="" [1]="2" )
|
||||
declare -A foo=([d]="4" [c]="3" [b]="2" [a]="1" )
|
||||
foo=( d "4" c "3" b "2" a "1" )
|
||||
declare -A foo=(["spa ces"]="2" ["\\"]="5" ["@"]="3" ["holy hell this works"]="4" ["a b"]="1" )
|
||||
foo=( echo "spa ces" "2" "\\" "5" "@" "3" "holy hell this works" "4" "a b" "1" )
|
||||
./assoc11.sub: line 34: "": bad array subscript
|
||||
declare -A foo=(["foo[bar"]="bleh" [";"]="semicolon" ["]"]="def" [a=b]="assignment" ["a]a"]="abc" )
|
||||
foo=( "foo[bar" "bleh" ";" "semicolon" "]" "def" a=b "assignment" "a]a" "abc" )
|
||||
declare -A foo=(["'"]="squote" ["\""]="dquote" ["\\"]="bslash" ["\`"]="backquote" )
|
||||
foo=( "'" "squote" "\"" "dquote" "\\" "bslash" "\`" "backquote" )
|
||||
declare -A foo=(["bar]bie"]="doll" ["a]=test1;#a"]="123" ["bar\"bie"]="doll" )
|
||||
foo=( "bar]bie" "doll" "a]=test1;#a" "123" "bar\"bie" "doll" )
|
||||
declare -A inside=([c]="3" [b]="2" [a]="1" )
|
||||
inside=( c "3" b "2" a "1" )
|
||||
declare -A dict=(["?"]="quest" ["*"]="star" ["'"]="squote" ["\$"]="dol" ["\""]="dquote" ["\\"]="bslash" ["@"]="at" ["}"]="rbrace" ["{"]="lbrace" ["\`"]="bquote" )
|
||||
dict=( "?" "quest" "*" "star" "'" "squote" "\$" "dol" "\"" "dquote" "\\" "bslash" "@" "at" "}" "rbrace" "{" "lbrace" "\`" "bquote" )
|
||||
declare -A foo=([two]="" [one]="1" )
|
||||
foo=( two "" one "1" )
|
||||
|
||||
@@ -241,3 +241,6 @@ ${THIS_SH} ./assoc8.sub
|
||||
${THIS_SH} ./assoc9.sub
|
||||
|
||||
${THIS_SH} ./assoc10.sub
|
||||
|
||||
# test assigning associative arrays using compound key/value pair assignments
|
||||
${THIS_SH} ./assoc11.sub
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
# 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/>.
|
||||
#
|
||||
# these tests were previously in array19.sub, but they are acceptable syntax now
|
||||
|
||||
declare -A a
|
||||
declare a='(1 2 3)'
|
||||
declare -p a
|
||||
unset a
|
||||
|
||||
declare -A foo
|
||||
|
||||
v1='spa ces'
|
||||
v2=@
|
||||
|
||||
foo=(a 1 b 2 c 3 d 4 )
|
||||
declare -p foo
|
||||
echo foo=\( ${foo[@]@K} \)
|
||||
|
||||
foo=('a b' 1 "$v1" 2 "$v2" 3 'holy hell this works' 4 \\ 5)
|
||||
declare -p foo
|
||||
echo foo=\( echo ${foo[@]@K} \)
|
||||
|
||||
foo=( "" null )
|
||||
|
||||
foo=('a]a' abc ']' def $(echo 'foo[bar') bleh \; semicolon a=b assignment)
|
||||
declare -p foo
|
||||
echo foo=\( ${foo[@]@K} \)
|
||||
|
||||
foo=('`' backquote '"' dquote "'" squote \\ bslash)
|
||||
declare -p foo
|
||||
echo foo=\( ${foo[@]@K} \)
|
||||
|
||||
bar='a]=test1;#a'
|
||||
foo=( $bar 123 bar\"bie doll bar]bie doll )
|
||||
declare -p foo
|
||||
echo foo=\( ${foo[@]@K} \)
|
||||
|
||||
func()
|
||||
{
|
||||
declare -A inside=(a 1 b 2 c 3)
|
||||
declare -p inside
|
||||
echo inside=\( ${inside[@]@K} \)
|
||||
}
|
||||
func
|
||||
|
||||
loaddict()
|
||||
{
|
||||
dict=( '"' dquote '`' bquote "'" squote '\' bslash)
|
||||
dict+=( '$' dol @ at * star \{ lbrace \} rbrace ? quest)
|
||||
|
||||
declare -p dict
|
||||
echo dict=\( ${dict[@]@K} \)
|
||||
}
|
||||
declare -A dict
|
||||
loaddict
|
||||
|
||||
foo=(one 1 two)
|
||||
declare -p foo
|
||||
echo foo=\( ${foo[@]@K} \)
|
||||
+7
-1
@@ -701,7 +701,13 @@ aaa bbb
|
||||
'aaa' 'bbb'
|
||||
a bbb
|
||||
aaa bb
|
||||
'string'
|
||||
'value with spaces'
|
||||
'a b' 'c d' 'e f'
|
||||
'a b' 'c d' 'e f'
|
||||
0 "zero" 1 "one" 2 "two" 3 "three"
|
||||
0 "zero z" 1 "one o" 2 "two t" 3 "three t"
|
||||
argv[1] = </>
|
||||
argv[1] = </>
|
||||
|
||||
./new-exp.tests: line 643: ABXD: parameter unset
|
||||
./new-exp.tests: ABXD: parameter unset
|
||||
|
||||
+4
-2
@@ -623,6 +623,9 @@ ${THIS_SH} ./new-exp12.sub
|
||||
# more indirect expansion and parameter transformation issues
|
||||
${THIS_SH} ./new-exp13.sub
|
||||
|
||||
# new K parameter transformation operator
|
||||
${THIS_SH} ./new-exp14.sub
|
||||
|
||||
# problems with stray CTLNUL in bash-4.0-alpha
|
||||
unset a
|
||||
a=/a
|
||||
@@ -638,6 +641,5 @@ patfunc foo
|
||||
# caused core dumps because of bad bracket expression parsing in bash-5.0
|
||||
eval : $'${x/#[0\xef\xbf\xbd\\Z[:]]}'
|
||||
|
||||
# this must be last!
|
||||
expect $0: 'ABXD: parameter unset'
|
||||
recho ${ABXD:?"parameter unset"}
|
||||
${THIS_SH} -c 'recho ${ABXD:?"parameter unset"}' $0
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# test the other uses of the 'K' tranform operator
|
||||
# the associative array tests are performed separately, since that was the
|
||||
# original motivation for this feature
|
||||
foo=string
|
||||
bar='value with spaces'
|
||||
|
||||
set -- 'a b' 'c d' 'e f'
|
||||
|
||||
echo ${foo@K}
|
||||
echo ${bar@K}
|
||||
|
||||
echo ${@@K}
|
||||
echo "${@@K}"
|
||||
|
||||
foo=( zero one two three )
|
||||
echo ${foo[@]@K}
|
||||
|
||||
foo=( 'zero z' 'one o' 'two t' 'three t' )
|
||||
echo ${foo[@]@K}
|
||||
@@ -26,3 +26,8 @@ extern
|
||||
0
|
||||
0
|
||||
123
|
||||
bar1
|
||||
ouch
|
||||
bar2
|
||||
foo
|
||||
subshell
|
||||
|
||||
@@ -102,6 +102,7 @@ echo extern
|
||||
FN=$TMPDIR/bashtest-$$
|
||||
cat >$FN << \EOF
|
||||
wc -l < $1
|
||||
case $1 in *sh-np*) [ -e $1 ] || { echo 0; echo 0; echo 0; echo 0; return; } ;; esac
|
||||
wc -l < $1
|
||||
wc -l < $1
|
||||
true | wc -l < $1
|
||||
@@ -117,3 +118,4 @@ moo() { ls -al "$1" >/dev/null; (true); ls -al "$1" >/dev/null; }; moo >(true)
|
||||
unset -f moo
|
||||
|
||||
${THIS_SH} ./procsub1.sub
|
||||
${THIS_SH} ./procsub2.sub
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
|
||||
# test whether or not we remove FIFOs and close pipe file descriptors too
|
||||
# aggressively
|
||||
|
||||
ouch()
|
||||
{
|
||||
while read foo; do echo "$foo"; done < <(echo bar1)
|
||||
cat "$1"
|
||||
}
|
||||
|
||||
ouch <(echo ouch )
|
||||
|
||||
ouch2()
|
||||
{
|
||||
{ cat; } < <(echo bar2)
|
||||
cat "$1"
|
||||
}
|
||||
|
||||
exec 4< <(echo subshell)
|
||||
ouch2 <(echo foo )
|
||||
|
||||
read var <&4
|
||||
echo $var
|
||||
Reference in New Issue
Block a user