bash-5.2-beta release

This commit is contained in:
Chet Ramey
2022-04-13 11:01:08 -04:00
parent 4491c03014
commit 187661b892
119 changed files with 14991 additions and 12391 deletions
+76 -4
View File
@@ -1,3 +1,78 @@
This document details the changes between this version, bash-5.2-beta, and
the previous version, bash-5.2-alpha.
1. Changes to Bash
a. Fixed a problem with command-oriented history and multi-line commands that
caused embedded blank lines to be run together.
b. Changed the way `&' is quoted when performing pattern substitution and
`patsub_replacement' is enabled.
c. Fixed some integer overflows when expanding strings or reading the output
of command substitution larger than 2GB.
d. `wait -p' without the `-n' option now does something useful if there are no
jobs.
e. Fixed an issue with read timeouts in posix mode.
f. Changed here-document processing to process $'...' and $"..." only when they
appear in the WORD portion of ${PARAM OP WORD} in the here-document body
and the body is being expanded.
g. Changed alias expansion in command substitution to be posix-conformant
(performed while initially parsing the command substitution) when in posix
mode.
h. Bash optimizes away more forks in subshells.
i. Here-document construction now performs quote removal on the here-document
delimiter only if it's marked as quoted, which prevents quote characters in
command substitutions from being removed.
j. Prompt string expansion now gives invisible characters in the expansion of
the \w, \W, and \s escape sequences a visible representation to avoid
problems with redisplay.
k. Fixed a problem with SIGINT during the execution of a command bound with
`bind -x' affecting the saved terminal settings.
l. Fixed an inconsistency with how $@ expands in a construct like ${@:+set}
or ${array[@]:+set} in the presence of null positional parameters or
array elements.
2. Changes to Readline
a. Prevent some display problems when running a command as the result of a
trap or one bound using `bind -x' and the command generates output.
b. Fixed an issue with multi-line prompt strings that have one or more
invisible characters at the end of a physical line.
c. Fixed an issue that caused a history line's undo list to be cleared when
it should not have been.
3. New Features in Bash
a. There is a new bindable readline command name: `vi-edit-and-execute-command'.
4. New Features in Readline
a. Two new bindable string variables: active-region-start-color and
active-region-end-color. The first sets the color used to display the
active region; the second turns it off. If set, these are used in place
of terminal standout mode.
b. New readline state (RL_STATE_EOF) and application-visible variable
(rl_eof_found) to allow applications to detect when readline reads EOF
before calling the deprep-terminal hook.
c. There is a new configuration option: --with-shared-termcap-library, which
forces linking the shared readline library with the shared termcap (or
curses/ncurses/termlib) library so applications don't have to do it.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.2-alpha, and
the previous version, bash-5.1-release.
@@ -313,10 +388,7 @@ g. There is a new option: `enable-active-region'. This separates control of
h. rl_completer_word_break_characters is now `const char *' like
rl_basic_word_break_characters.
i. The non-incremental history searches now leave the current history offset
at the position of the last matching history entry, like incremental search.
j. Readline looks in $LS_COLORS for a custom filename extension
i. Readline looks in $LS_COLORS for a custom filename extension
(*.readline-colored-completion-prefix) and uses that as the default color
for the common prefix displayed when `colored-completion-prefix' is set.
+535
View File
@@ -2914,3 +2914,538 @@ examples/loadables/accept.c
----
configure.ac
- bumped version to 5.2-alpha.
1/16
----
tests/{unicode1,glob2,intl2}.sub, tests/run-intl
- minor changes to add warnings for missing locales that cause test
failures
1/17
----
parse.y
- history_delimiting_chars: if we have a blank line by the time we
hit the end of the tests, return a semicolon for the first blank
line to avoid running lines of a multi-line command together.
Fixes bug reported by Joakim Lindblad <joakim@cb.uu.se>
subst.c
- expand_string_for_patsub: expand the replacement string for pattern
substitution assuming that it will eventually be passed to
strcreplace to replace `&' with the matched portion of the string.
This calls expand_string_for_pat(), which leaves the string quoted
and does not perform word splitting, then calls
quote_string_for_repl to post-process the expanded string.
- quote_string_for_repl: perform quote removal on passed string while
replacing CTLESC escaping a `&' or a backslash with a backslash. The
result must be passed to strcreplace
- parameter_brace_patsub: call expand_string_for_patsub if
patsub_replacement is set to quote
1/18
----
subst.c
- read_comsub: make istring_index a size_t to avoid overflow with very
large values of istring_size.
From https://savannah.gnu.org/support/index.php?110596
- expand_word_internal: make istring_index a size_t
1/20
----
buitins/cd.def
- add a description of `cd -' to the help text. Suggested by
Rob Landley <rob@landley.net>
1/21
----
lib/glob/glob.c
- glob_vector: if we allocate NEXTLINK using malloc, and free it due to
some allocation failure, reset FIRSTMALLOC to avoid duplicate frees
later on
subst.[ch]
- sub_append_string: the INDX parameter is now a size_t to avoid
overflow
parse.y
- decode_prompt_string: RESULT_INDEX is now a size_t to pass to
sub_append_string
jobs.[ch],nojobs.c
- wait_for_background_pids: now returns the number of jobs/processes
reaped
builtins/wait.def
- wait_builtin: if -p pid supplied without -n, make sure we do something
useful if no job/pid arguments are supplied and there are no jobs.
Reported by Oguz <oguzismailuysal@gmail.com>
builtins/read.def
- read_builtin: if we have a timeout, use SIGALRM instead of select
when in posix mode, since we use read instead of zread. Fixes bug
reported by Andreas Schwab <schwab@linux-m68k.org>
subst.c
- expand_string_dollar_quote: handle single-quoted and double-quoted
strings that might include $' and $" without attempting translation;
do more error checking for unterminated $' and $" that leaves those
characters unmodified. This is for use by readline's various line
expansion functions (shell_expand_line)
1/23
----
parse.y,make_cmd.c
- revert change that unconditionally processes $'...' and $"..." in
here-document bodies; there are only a couple of cases where they
should be processed in a double-quote environment
1/24
----
subst.c
- extract_dollar_brace_string: if we see another `${' on the rhs of
the operator, reset the dolbrace_state to DOLBRACE_PARAM while we
read this new ${...} string
- extract_heredoc_dolbrace_string: new function, variant of
extract_dollar_brace_string, to process the WORD in ${PARAM OP WORD}
while expanding lines of here-document data. It's complicated by the
requirement to add to the result string as we go along, since we
need to change the contents of the input string with ansi expansion
or locale translation.
- string_extract_single_quoted: take a new third argument: ALLOWESC.
This allows backslash to escape an embedded single quote, needed by
extract_heredoc_dolbrace_string to process $'...'; changed callers
1/25
----
parse.y
- parse_matched_pair: ansi-expand $'...' in WORD for ${PARAM OP WORD}
and single-quote the result if dolbrace_state == DOLBRACE_QUOTE
(posix pattern removal operators) even if extended_quote == 0
subst.c
- extract_heredoc_dolbrace_string: add logic to align with parse.y:
parse_matched_pair and its $'...' expansion, including handling
extended_quote
1/27
----
builtins/evalstring.c
- should_optimize_fork: broke conditions for optimizing away the fork
for a simple command out of optimize_fork into new function, call
from should_suppress_fork and optimize_subshell_command. Call from
optimize_fork if (subshell_environment & SUBSHELL_PAREN), relying
on fact that CMD_TRY_OPTIMIZING is only set in a couple of specific
conditions
- optimize_fork: call should_suppress_fork only if startup_state == 2;
it does the extra checks for that specific case
- optimize_fork: call should_optimize_fork if we're in a (list)
subshell (subshell_environment & SUBSHELL_PAREN)
- optimize_subshell_command: set CMD_TRY_OPTIMIZING on the right side
of a `&&', `||', or `;' list as long as it's a simple command so
we can check with optimize_fork() when it's time to execute it
execute_cmd.c
- execute_in_subshell: call optimize_subshell_command for (list)
subshells to either set CMD_NO_FORK for simple commands or set
CMD_TRY_OPTIMIZING for likely candidates for later optimization
builtins/common.h,builtins/evalstring.c
- optimize_fork: renamed to optimize_connection_fork; changed callers
1/31
----
include/shmbutil.h
- COPY_CHAR_I,SCOPY_CHAR_I: add check for locale_utf8locale and
(c & 0x80) as in other macros
lib/sh/shquote.c
- sh_backslash_quote_for_double_quotes: rewrote to use array indexing
and COPY_CHAR_I to make it easier to drop in future calls to
charvis() to make `unsafe' characters visible if FLAGS == 1
2/1
---
parse.y
- parse_comsub: if we are currently expanding aliases, temporarily
turn off alias expansion if we are not in posix mode so we defer
alias expansion until command_substitute(). Fixes double-expansion
bug reported by Martijn Dekker <martijn@inlv.org> and aligns with
https://www.austingroupbugs.net/view.php?id=1342
- xparse_dolparen: turn off alias expansion entirely while running the
parser: either we do it in parse_comsub (posix mode) or in
command_substitute (default mode)
- parse_string_to_command: ditto
subst.c
- command_substitute: if we are expanding aliases, temporarily turn
off alias expansion if we are in posix mode, since we already
performed it in parse_comsub() and are using the command string
reconstituted from the parse result
doc/bashref.texi
- bash posix mode: add description of alias expansion and command
substitution parsing and execution
2/4
---
lib/readline/rltty.c
- rl_deprep_terminal: set _rl_last_c_pos to 0 after outputting
BRACK_PASTE_FINI, since the last character in that is \r. Partially
address issue raised by Markus Schwarzenberg <markus.schwarzenberg@freenet.de>
in https://lists.gnu.org/archive/html/bug-bash/2022-02/msg00056.html
2/5
---
doc/{bash.1,bashref.texi}
- minor typo fixes from Helge Kreutzmann <debian@helgefjell.de>
2/7
---
{arrayfunc,variables}.c
- ARRAY_EXPORT: changes to encode array and assoc variables using a
scheme similar to shell functions so we can export arrays and
differentiate them from scalar variables and differentiate array
and assoc variables. Still not enabled by default.
variables.c
- mk_env_string: third argument is now the variable's attributes or 0,
with all the attributes we can export arrays
lib/readline/bind.c
- active-region-start-color,active-region-end-color: new bindable
string variables, one to set the active region color (instead of
standout mode) and one to turn it off (instead of the "se" terminal
capability). They set _rl_active_region_start_color and
_rl_active_region_end_color variables via functions
lib/readline/display.c
- putc_face: if setting standout mode, check for both the start color
and end color variables and output the start color string. If turning
off standout mode (normal face), output the end color string. Both
variables must be set
lib/readline/{readline.c,rlprivate.h}
- declarations for _rl_active_region_start_color and
_rl_active_region_end_color
2/8
---
bashline.c
- initialize_readline: add bindable name `vi-edit-and-execute-command'
shell.c
- subshell_exit: make sure to set last_command_exit_value before
calling the exit trap. Fixes bug reported by Greg Edwards
<gedwards@ddn.com>
2/9
---
lib/readline/{terminal.c,rlprivate.h}
- _rl_region_color_on,_rl_region_color_off: functions to output the
_rl_active_region_start_color and _rl_active_region_end_color
- _rl_reset_region_color: function to encapsulate setting the region
color to an arbitrary string, including doing memory management
lib/readline/display.c
- putc_face: call _rl_region_color_on and _rl_region_color_off instead
of _rl_standout_on and _rl_standout_off
lib/readline/terminal.c
- _rl_init_terminal_io: initialize _rl_active_region_start_color and
_rl_active_region_end_color from _rl_term_so and _rl_term_se,
respectively; reset every time the terminal is changed
- _rl_init_terminal_io: turn off the active region for a dumb terminal
lib/readline/bind.c
- sv_region_{start,end}_color: call _rl_reset_region_color with the
appropriate value for WHICH
2/10
----
lib/readline/doc/{rluser.texi,readline.3},doc/bash.1
- active-region-start-color,active-region-end-color: documented new
bindable readline variables
- enable-active-region: document using active-region-start-color to
highlight the text in the region
2/11
----
parse.y
- read_token,read_token_word: make sure characters read by shell_getc
are protected by appropriate calls to MBTEST when testing for shell
metacharacters and operators
2/14
----
builtins/shopt.def
- set_compatibility_level: if the current compatibility level is outside
the range of the compatNN options, just leave it alone when
unsetting one of the options (which by definition was already
unset). Fixes issue reported by Mihai Moldovan <ionic@ionic.de>
2/16
----
lib/readline/search.c
- rl_history_search_{pos,len,flags}: rename to have a leading `_'
- _rl_history_search_pos: no longer static so other parts of readline
can see it
lib/readline/rlprivate.h
- _rl_history_search_pos: extern declaration
lib/readline/readline.c
- readline_internal_teardown: don't run the undo list against the
current history entry if the non-incremental search functions have
set _rl_history_search_pos to it, since it doesn't reflect the
current contents of the line buffer. Fixes issue reported by
Andreas Schwab <schwab@linux-m68k.org>
lib/readline/misc.c
- _rl_start_using_history: initialize _rl_history_search_pos to
something invalid so it doesn't match where_history()
2/17
----
lib/readline/callback.c
- rl_callback_read_char: make sure _rl_eof_found is set to the value
of eof before calling the deprep terminal function, so it can do
different things based on whether the input code read EOF (or the
user entered the EOF character). From a gdb discussion started by
Andrew Burgess <aburgess@redhat.com> (still more to do, since this
is not part of the public API)
2/18
----
lib/readline/readline.h
- RL_STATE_EOF: new readline state value; set when readline reads an
EOF character on an empty line or a read returns an error
- rl_eof_found: new public variable
lib/readline/rprivate.h
- _rl_eof_found: renamed to rl_eof_found, so not declared here
lib/readline/{callback,readline}.c
- RL_STATE_EOF: set appropriately when readline gets an EOF. Suggested
by Andrew Burgess <aburgess@redhat.com>
- RL_STATE_EOF: make sure it's not set when readline starts
- rl_eof_found: set appropriately when readline gets an EOF
lib/readline/{callback,readline,rltty}.c
- rl_eof_found: new name for _rl_eof_found
lib/readline/doc/rltech.texi
- RL_STATE_EOF: document
2/19
----
parse.y
- parse_comsub: turn off parser state flags we don't want to inherit
into this call to the parser (PST_REGEXP, PST_EXTPAT, PST_CONDCMD,
PST_CONDEXPR for now). Fixes bug reported by konsolebox
<konsolebox@gmail.com>
2/23
----
findcmd.c,builtins/hash.def
- replace calls to is_directory with file_isdir, which only performs a
stat and doesn't do the eaccess call to check for an executable file
findcmd.c
- find_in_path_element: takes a new RFLAGSP argument, an int * where
the status flags for the returned pathname are returned; saves
additional calls to stat/eaccess
- search_for_command: get the returned flags from
find_user_command_in_path so we don't need any additional calls to
file_status after we find the command in $PATH
2/24
----
doc/{bash.1,bashref.texi}
- FUNCTIONS: some small changes to the description of local variables
and dynamic scoping, with emphasis on how that affects `unset'
behavior. Inspired by a discussion with
Christoph Anton Mitterer <calestyo@scientia.net>
2/25
----
examples/loadables/realpath.c
- renamed -s option to -q to align with other versions
- perform array assignment for `-a varname' even if -q option supplied
- renamed -S option to -s for Linux compatibility
2/28
----
lib/readline/misc.c
- _rl_free_saved_history_line: call rl_free_undo_list, saving and
setting rl_undo_list to the saved history line's data, so the right
call to _hs_replace_history_data happens and we don't end up with
a pointer aliasing problem. Fixes core dump reported by
Andreas Schwab <schwab@linux-m68k.org>, but does not make his
scenario equivalent to incremental search
3/1
---
lib/readline/search.c
- make_history_line_current: save the current line before replacing it
with the found history entry using rl_maybe_save_line
- noninc_dosearch: we don't want the saved history line, so free it
after calling make_history_line_current
- _rl_history_search_internal: call rl_maybe_replace_line after making
changes to the line buffer with make_history_line_current so we can
save the undo list we constructed before we set the history position
3/2
---
lib/readline/display.c
- expand_prompt: add missing piece to patch from 10/26/2021: if we are
recalculating the number of invisible characters on the first line
of the prompt, we need to update INVFL, even if we already set it
when we hit the number of physical characters. This ends up being
assigned to prompt_invis_chars_first_line, and is used in several
subsequent calculations. Reported by
Andreas Schwab <schwab@linux-m68k.org>
lib/readline/doc/{readline.3,rluser.texi},doc/bash.1
- enable-bracketed-paste: add some language making it clearer that
bracketed paste prevents the pasted text from being interpreted as
editing commands. Suggested by Karl O. Pinc <kop@karlpinc.com>
3/4
---
make_cmd.c
- make_here_document: perform quote removal on the here-doc delimiter
only if it's marked as quoted, which prevents quotes from inside a
command substitution from being removed (they're supposed to begin a
new quoting context) when the word itself isn't flagged as quoted
(which means the body of the here-document gets expanded). You can't
perform quote removal *and* expand the here-document lines. From an
austin-group discussion back in early February
lib/sh/strvis.c
- charvis -> sh_charvis; change caller
- sh_charvis: now take an additional SLEN argument to avoid having to
compute the string length every time; change callers
- sh_charvis: add a utf-8 locale-specific check before calling
COPY_CHAR_I (in practice, doesn't make any real difference)
3/10
----
arrayfunc.c
- convert_var_to_array: if we're being asked to create an associative
array (flags & 2), and we have an existing variable that is not an
assoc array (and not an existing indexed array), call
convert_var_to_assoc to make it one
3/11
----
jobs.c
- wait_for: don't call get_tty_state() if readline is dispatching
(RL_STATE_DISPATCHING) with the terminal settings changed
(RL_STATE_TERMPREPPED), the same way we don't if we are running a
command for programmable completion. Fixes bug with SIGINT reverting
to the saved readline terminal settings reported by
Markus Napierkowski <markus.napierkowski@cyberus-technology.de>
parse.y
- decode_prompt_string: make sure the expansion of \w, \W, and \s
are all run through sh_strvis before calling
sh_backslash_quote_for_double_quotes or just through sh_strvis if
we're not running the prompt string through word expansions.
Fixes issue reported by Josh Harcome <joshharc@gmail.com> back
in mid-January
3/16
----
bashline.c
- bash_quote_filename: if we have a word to complete that contains
characters that introduce a word expansion, make sure the passed
string does *not* exist as a filename before removing those
characters from the set that must be backslash-quoted. See change
from 1/1/2022
3/18
----
lib/readline/search.c
- make_history_line_current: don't free rl_undo_list or
_rl_saved_line_for_history; don't unconditionally save the history
line. This reverts some of the changes to support setting the
history position in history-search-backward
- rl_history_search_internal: only free the saved history line if we
were the ones who created it
3/21
----
lib/readline/nls.c
- xmalloc.h: include for systems without setlocale(), so xfree has a
prototype. Report and fix from András Kucsma <r0maikx02b@gmail.com>
lib/readline/search.c
- _rl_history_search_internal: use previous-history/next-history to
move to the found history line instead of directly calling
history_set_pos. This makes the behavior more similar to incremental
search
- rl_history_search_internal: make sure to set rl_undo_list to the
current history undo list around the calls to rl_get_previous_history
or rl_get_next_history, in order to fool the call to
maybe_replace_line they make
lib/readline/readline.c
- _rl_executing_func: the currently-executing readline command function
lib/readline/rlprivate.h
- _rl_executing_func: extern declaration
lib/readline/search.c
- _rl_history_search_internal: removed (commented out) code that sets
the current history entry to the found history entry, too much
assumes that the current undo list should be applied to the current
history entry (where_history())
3/23
----
subst.c
- parameter_brace_expand_word: if we have double-quoted ${*} or ${@},
make sure we are setting W_HASQUOTEDNULL in the flags we return to
the caller if we are returning QUOTED_NULL(word)
- parameter_brace_expand_word: if we have a double-quoted associative
array reference using `*' or `@', make sure we are setting
W_HASQUOTEDNULL in the flags we return to the caller if we are
returning QUOTED_NULL(word)
- parameter_brace_expand: if we're using the `[:]+' word expansion
operator, we need to note a quoted null string and pass the
W_QUOTEDNULL flag back to the caller
- expand_word_internal: make sure to return a QUOTED_NULL
(word[0] == CTLNUL) back to the caller if HAD_QUOTED_NULL is set,
regardless of whether or not we see a quoted dollar at. Fix for bug
reported by Andreas Luik <andreas.luik@innovative-navigation.de>
arrayfunc.c
- array_value_internal: fix typo and set estatep->type to ARRAY_INDEXED
for indexed arrays
3/31
----
lib/readline/{history.c,histlib.h}
- _hs_at_end_of_history: convenience function to tell whether or not
the current history position is at the end of the history list
4/1
---
lib/readline/search.c
- make_history_line_current: don't free rl_undo_list if it is equal to
_rl_saved_line_for_history->data, since we will need to restore it
later if we got it from a history entry. Fixes issue dating back to
7/2021 and changes to _rl_free_saved_line_for_history, current issue
reported by Andreas Schwab <schwab@linux-m68k.org>
4/5
---
lib/readline/{complete,histfile,histsearch,isearch,terminal}.c
- xfree: use instead of free
4/7
---
configure.ac
- bumped version to bash-5.2-beta
+8 -3
View File
@@ -148,10 +148,11 @@ redir.h f
bashtypes.h f
mailcheck.h f
xmalloc.h f
y.tab.c f
y.tab.h f
parser-built f
pathnames.h.in f
# order is important here
y.tab.c F
y.tab.h F
parser-built F
builtins/Makefile.in f
builtins/alias.def f
builtins/bind.def f
@@ -453,6 +454,7 @@ lib/sh/strtoul.c f
lib/sh/strtoull.c f
lib/sh/strtoumax.c f
lib/sh/strtrans.c f
lib/sh/strvis.c f
lib/sh/timers.c f
lib/sh/times.c f
lib/sh/timeval.c f
@@ -1035,6 +1037,8 @@ tests/dollar-at-star6.sub f
tests/dollar-at-star7.sub f
tests/dollar-at-star8.sub f
tests/dollar-at-star9.sub f
tests/dollar-at-star10.sub f
tests/dollar-at-star11.sub f
tests/dollar-at1.sub f
tests/dollar-at2.sub f
tests/dollar-at3.sub f
@@ -1272,6 +1276,7 @@ tests/nquote1.sub f
tests/nquote2.sub f
tests/nquote3.sub f
tests/nquote4.sub f
tests/nquote5.sub f
tests/nquote1.tests f
tests/nquote1.right f
tests/nquote2.tests f
+1 -1
View File
@@ -239,7 +239,7 @@ SHLIB_SOURCE = ${SH_LIBSRC}/clktck.c ${SH_LIBSRC}/getcwd.c \
${SH_LIBSRC}/wcswidth.c ${SH_LIBSRC}/wcsnwidth.c \
${SH_LIBSRC}/shmbchar.c ${SH_LIBSRC}/utf8.c \
${SH_LIBSRC}/random.c ${SH_LIBSRC}/gettimeofday.c \
${SH_LIBSRC}/timers.c
${SH_LIBSRC}/timers.c ${SH_LIBSRC}/strvis.c
SHLIB_LIB = -lsh
SHLIB_LIBNAME = libsh.a
+17 -4
View File
@@ -97,6 +97,9 @@ bb. Array references using `@' and `*' that are the value of nameref variables
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
set -u is enabled and the array (v) is unset.
cc. There is a new bindable readline command name:
`vi-edit-and-execute-command'.
2. New Features in Readline
a. There is now an HS_HISTORY_VERSION containing the version number of the
@@ -129,13 +132,23 @@ g. There is a new option: `enable-active-region'. This separates control of
h. rl_completer_word_break_characters is now `const char *' like
rl_basic_word_break_characters.
i. The non-incremental history searches now leave the current history offset
at the position of the last matching history entry, like incremental search.
j. Readline looks in $LS_COLORS for a custom filename extension
i. Readline looks in $LS_COLORS for a custom filename extension
(*.readline-colored-completion-prefix) and uses that as the default color
for the common prefix displayed when `colored-completion-prefix' is set.
j. Two new bindable string variables: active-region-start-color and
active-region-end-color. The first sets the color used to display the
active region; the second turns it off. If set, these are used in place
of terminal standout mode.
k. New readline state (RL_STATE_EOF) and application-visible variable
(rl_eof_found) to allow applications to detect when readline reads EOF
before calling the deprep-terminal hook.
l. There is a new configuration option: --with-shared-termcap-library, which
forces linking the shared readline library with the shared termcap (or
curses/ncurses/termlib) library so applications don't have to do it.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-5.1 since
the release of bash-5.0. As always, the manual page (doc/bash.1) is
+59 -52
View File
@@ -33,73 +33,80 @@ The following list is what's changed when 'POSIX mode' is in effect:
7. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
8. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
8. Alias expansion is performed when initially parsing a command
substitution. The default mode generally defers it, when enabled,
until the command substitution is executed. This means that
command substitution will not expand aliases that are defined after
the command substitution is initially parsed (e.g., as part of a
function definition).
9. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
and '!!' to '!' are enabled, and parameter expansion is performed
on the values of 'PS1' and 'PS2' regardless of the setting of the
'promptvars' option.
9. The POSIX startup files are executed ('$ENV') rather than the
10. The POSIX startup files are executed ('$ENV') rather than the
normal Bash files.
10. Tilde expansion is only performed on assignments preceding a
11. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
11. The default history file is '~/.sh_history' (this is the default
12. The default history file is '~/.sh_history' (this is the default
value of '$HISTFILE').
12. Redirection operators do not perform filename expansion on the
13. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
13. Redirection operators do not perform word splitting on the word in
14. Redirection operators do not perform word splitting on the word in
the redirection.
14. Function names must be valid shell 'name's. That is, they may not
15. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
15. Function names may not be the same as one of the POSIX special
16. Function names may not be the same as one of the POSIX special
builtins.
16. POSIX special builtins are found before shell functions during
17. POSIX special builtins are found before shell functions during
command lookup.
17. When printing shell function definitions (e.g., by 'type'), Bash
18. When printing shell function definitions (e.g., by 'type'), Bash
does not print the 'function' keyword.
18. Literal tildes that appear as the first character in elements of
19. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
19. The 'time' reserved word may be used by itself as a command. When
20. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
20. When parsing and expanding a ${...} expansion that appears within
21. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
21. The parser does not recognize 'time' as a reserved word if the
22. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
22. The '!' character does not introduce history expansion within a
23. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
23. If a POSIX special builtin returns an error status, a
24. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
24. A non-interactive shell exits with an error status if a variable
25. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
25. A non-interactive shell exits with an error status if a variable
26. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command. For any
other simple command, the shell aborts execution of that command,
@@ -107,133 +114,133 @@ The following list is what's changed when 'POSIX mode' is in effect:
perform any further processing of the command in which the error
occurred").
26. A non-interactive shell exits with an error status if the
27. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
27. Non-interactive shells exit if FILENAME in '.' FILENAME is not
28. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
28. Non-interactive shells exit if a syntax error in an arithmetic
29. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
29. Non-interactive shells exit if a parameter expansion error occurs.
30. Non-interactive shells exit if a parameter expansion error occurs.
30. Non-interactive shells exit if there is a syntax error in a script
31. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
31. While variable indirection is available, it may not be applied to
32. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
32. When expanding the '*' special parameter in a pattern context
33. When expanding the '*' special parameter in a pattern context
where the expansion is double-quoted does not treat the '$*' as if
it were double-quoted.
33. Assignment statements preceding POSIX special builtins persist in
34. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
34. The 'command' builtin does not prevent builtins that take
35. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
35. The 'bg' builtin uses the required format to describe each job
36. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
36. The output of 'kill -l' prints all the signal names on a single
37. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
37. The 'kill' builtin does not accept signal names with a 'SIG'
38. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
38. The 'export' and 'readonly' builtin commands display their output
39. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
39. The 'trap' builtin displays signal names without the leading
40. The 'trap' builtin displays signal names without the leading
'SIG'.
40. The 'trap' builtin doesn't check the first argument for a possible
41. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
41. 'trap -p' displays signals whose dispositions are set to SIG_DFL
42. 'trap -p' displays signals whose dispositions are set to SIG_DFL
and those that were ignored when the shell started.
42. The '.' and 'source' builtins do not search the current directory
43. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
43. Enabling POSIX mode has the effect of setting the
44. Enabling POSIX mode has the effect of setting the
'inherit_errexit' option, so subshells spawned to execute command
substitutions inherit the value of the '-e' option from the parent
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
44. Enabling POSIX mode has the effect of setting the 'shift_verbose'
45. Enabling POSIX mode has the effect of setting the 'shift_verbose'
option, so numeric arguments to 'shift' that exceed the number of
positional parameters will result in an error message.
45. When the 'alias' builtin displays alias definitions, it does not
46. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
46. When the 'set' builtin is invoked without options, it does not
47. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
47. When the 'set' builtin is invoked without options, it displays
48. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
48. When the 'cd' builtin is invoked in logical mode, and the pathname
49. When the 'cd' builtin is invoked in logical mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to physical mode.
49. When the 'cd' builtin cannot change a directory because the length
50. When the 'cd' builtin cannot change a directory because the length
of the pathname constructed from '$PWD' and the directory name
supplied as an argument exceeds 'PATH_MAX' when all symbolic links
are expanded, 'cd' will fail instead of attempting to use only the
supplied directory name.
50. The 'pwd' builtin verifies that the value it prints is the same as
51. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
51. When listing the history, the 'fc' builtin does not include an
52. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
52. The default editor used by 'fc' is 'ed'.
53. The default editor used by 'fc' is 'ed'.
53. The 'type' and 'command' builtins will not report a non-executable
54. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
54. The 'vi' editing mode will invoke the 'vi' editor directly when
55. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
55. When the 'xpg_echo' option is enabled, Bash does not attempt to
56. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
57. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
58. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
58. The 'read' builtin may be interrupted by a signal for which a trap
59. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
59. Bash removes an exited background process's status from the list
60. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
There is other POSIX behavior that Bash does not implement by default
Vendored
+2 -1
View File
@@ -990,7 +990,8 @@ elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=
TERMCAP_DEP=
else
TERMCAP_LIB=-lcurses
# we assume ncurses is installed somewhere the linker can find it
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
fi
])
+11 -1
View File
@@ -379,6 +379,14 @@ assign_array_element (name, value, flags, estatep)
entry = assign_array_element_internal (entry, name, vname, sub, sublen, value, flags, estatep);
#if ARRAY_EXPORT
if (entry && exported_p (entry))
{
INVALIDATE_EXPORTSTR (entry);
array_needs_making = 1;
}
#endif
free (vname);
return entry;
}
@@ -496,6 +504,8 @@ find_or_make_array_variable (name, flags)
report_error (_("%s: cannot convert indexed to associative array"), name);
return ((SHELL_VAR *)NULL);
}
else if (flags & 2)
var = assoc_p (var) ? var : convert_var_to_assoc (var);
else if (array_p (var) == 0 && assoc_p (var) == 0)
var = convert_var_to_array (var);
@@ -1528,7 +1538,7 @@ array_value_internal (s, quoted, flags, estatep)
else
{
if (estatep)
estatep->type = ARRAY_ASSOC;
estatep->type = ARRAY_INDEXED;
l = array_to_word_list (array_cell (var));
if (l == (WORD_LIST *)NULL)
return ((char *) NULL);
+8 -7
View File
@@ -490,6 +490,9 @@ initialize_readline ()
rl_add_defun ("display-shell-version", display_shell_version, -1);
rl_add_defun ("edit-and-execute-command", emacs_edit_and_execute_command, -1);
#if defined (VI_MODE)
rl_add_defun ("vi-edit-and-execute-command", vi_edit_and_execute_command, -1);
#endif
#if defined (BRACE_COMPLETION)
rl_add_defun ("complete-into-braces", bash_brace_completion, -1);
@@ -2848,10 +2851,6 @@ history_and_alias_expand_line (count, ignore)
new_line = history_expand_line_internal (rl_line_buffer);
#endif
t = expand_string_dollar_quote (new_line ? new_line : rl_line_buffer, 0);
FREE (new_line);
new_line = t;
#if defined (ALIAS)
if (new_line)
{
@@ -4289,10 +4288,11 @@ bash_quote_filename (s, rtype, qcp)
special to the shell parser). */
expchar = nextch = closer = 0;
if (*qcp == '\0' && cs == COMPLETE_BSQUOTE && dircomplete_expand == 0 &&
(expchar = bash_check_expchar (s, 0, &nextch, &closer)))
(expchar = bash_check_expchar (s, 0, &nextch, &closer)) &&
file_exists (s) == 0)
{
/* Usually this will have been set by bash_directory_completion_hook, but
there are rare cases where it will not be. */
/* Usually this will have been set by bash_directory_completion_hook,
but there are cases where it will not be. */
if (rl_filename_quote_characters != custom_filename_quote_characters)
set_filename_quote_chars (expchar, nextch, closer);
complete_fullquote = 0;
@@ -4340,6 +4340,7 @@ bash_quote_filename (s, rtype, qcp)
/* We may need to quote additional characters: those that readline treats
as word breaks that are not quoted by backslash_quote. */
/* XXX - test complete_fullquote here? */
if (rtext && cs == COMPLETE_BSQUOTE)
{
mtext = quote_word_break_chars (rtext);
+2 -2
View File
@@ -1,7 +1,7 @@
This file is cd.def, from which is created cd.c. It implements the
builtins "cd" and "pwd" in Bash.
Copyright (C) 1987-2020 Free Software Foundation, Inc.
Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -79,7 +79,7 @@ $SHORT_DOC cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
HOME shell variable. If DIR is "-", it is converted to $OLDPWD.
The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
+2 -2
View File
@@ -1,6 +1,6 @@
/* common.h -- extern declarations for functions defined in common.c. */
/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -217,7 +217,7 @@ extern int parse_string PARAMS((char *, const char *, int, COMMAND **, char **))
extern int should_suppress_fork PARAMS((COMMAND *));
extern int can_optimize_connection PARAMS((COMMAND *));
extern int can_optimize_cat_file PARAMS((COMMAND *));
extern void optimize_fork PARAMS((COMMAND *));
extern void optimize_connection_fork PARAMS((COMMAND *));
extern void optimize_subshell_command PARAMS((COMMAND *));
extern void optimize_shell_function PARAMS((COMMAND *));
+31 -21
View File
@@ -1,6 +1,6 @@
/* evalstring.c - evaluate a string as one or more shell commands. */
/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -84,6 +84,24 @@ restore_lastcom (x)
the_printed_command_except_trap = x;
}
int
should_optimize_fork (command, subshell)
COMMAND *command;
int subshell;
{
return (running_trap == 0 &&
command->type == cm_simple &&
signal_is_trapped (EXIT_TRAP) == 0 &&
signal_is_trapped (ERROR_TRAP) == 0 &&
any_signals_trapped () < 0 &&
(subshell || (command->redirects == 0 && command->value.Simple->redirects == 0)) &&
((command->flags & CMD_TIME_PIPELINE) == 0) &&
((command->flags & CMD_INVERT_RETURN) == 0));
}
/* This has extra tests to account for STARTUP_STATE == 2, which is for
-c command but has been extended to command and process substitution
(basically any time you call parse_and_execute in a subshell). */
int
should_suppress_fork (command)
COMMAND *command;
@@ -94,14 +112,7 @@ should_suppress_fork (command)
return (startup_state == 2 && parse_and_execute_level == 1 &&
*bash_input.location.string == '\0' &&
parser_expanding_alias () == 0 &&
running_trap == 0 &&
command->type == cm_simple &&
signal_is_trapped (EXIT_TRAP) == 0 &&
signal_is_trapped (ERROR_TRAP) == 0 &&
any_signals_trapped () < 0 &&
(subshell || (command->redirects == 0 && command->value.Simple->redirects == 0)) &&
((command->flags & CMD_TIME_PIPELINE) == 0) &&
((command->flags & CMD_INVERT_RETURN) == 0));
should_optimize_fork (command, subshell));
}
int
@@ -115,13 +126,14 @@ can_optimize_connection (command)
}
void
optimize_fork (command)
optimize_connection_fork (command)
COMMAND *command;
{
if (command->type == cm_connection &&
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
(command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
should_suppress_fork (command->value.Connection->second))
((startup_state == 2 && should_suppress_fork (command->value.Connection->second)) ||
((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0))))
{
command->value.Connection->second->flags |= CMD_NO_FORK;
command->value.Connection->second->value.Simple->flags |= CMD_NO_FORK;
@@ -132,21 +144,19 @@ void
optimize_subshell_command (command)
COMMAND *command;
{
if (running_trap == 0 &&
command->type == cm_simple &&
signal_is_trapped (EXIT_TRAP) == 0 &&
signal_is_trapped (ERROR_TRAP) == 0 &&
any_signals_trapped () < 0 &&
command->redirects == 0 && command->value.Simple->redirects == 0 &&
((command->flags & CMD_TIME_PIPELINE) == 0) &&
((command->flags & CMD_INVERT_RETURN) == 0))
if (should_optimize_fork (command, 0))
{
command->flags |= CMD_NO_FORK;
command->value.Simple->flags |= CMD_NO_FORK;
}
else if (command->type == cm_connection &&
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR))
optimize_subshell_command (command->value.Connection->second);
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
command->value.Connection->second->type == cm_simple &&
parser_expanding_alias () == 0)
{
command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
command->value.Connection->second->value.Simple->flags |= CMD_TRY_OPTIMIZING;
}
}
void
+1 -1
View File
@@ -177,7 +177,7 @@ hash_builtin (list)
continue;
else if (pathname)
{
if (is_directory (pathname))
if (file_isdir (pathname))
{
#ifdef EISDIR
builtin_error ("%s: %s", pathname, strerror (EISDIR));
+1 -1
View File
@@ -471,7 +471,7 @@ read_builtin (list)
read_timeout->flags = SHTIMER_LONGJMP;
#if defined (HAVE_SELECT)
read_timeout->flags |= edit ? SHTIMER_ALARM : SHTIMER_SELECT;
read_timeout->flags |= (edit || posixly_correct) ? SHTIMER_ALARM : SHTIMER_SELECT;
#else
read_timeout->flags |= SHTIMER_ALARM;
#endif
+10 -1
View File
@@ -646,9 +646,14 @@ set_compatibility_level (option_name, mode)
char *option_name;
int mode;
{
int ind;
int ind, oldval;
char *rhs;
/* If we're unsetting one of the compatibility options, make sure the
current value is in the range of the compatNN space. */
if (mode == 0)
oldval = shell_compatibility_level;
/* If we're setting something, redo some of the work we did above in
toggle_shopt(). Unset everything and reset the appropriate option
based on OPTION_NAME. */
@@ -676,6 +681,8 @@ set_compatibility_level (option_name, mode)
shell_compatibility_level = 43;
else if (shopt_compat44)
shell_compatibility_level = 44;
else if (oldval > 44 && shell_compatibility_level < DEFAULT_COMPAT_LEVEL)
;
else
shell_compatibility_level = DEFAULT_COMPAT_LEVEL;
@@ -698,6 +705,8 @@ set_compatibility_opts ()
switch (shell_compatibility_level)
{
case DEFAULT_COMPAT_LEVEL:
case 51: /* completeness */
case 50:
break;
case 44:
shopt_compat44 = 1; break;
+2 -2
View File
@@ -235,8 +235,8 @@ wait_builtin (list)
currently active background processes. */
if (list == 0)
{
wait_for_background_pids (&pstat);
if (vname)
opt = wait_for_background_pids (&pstat);
if (vname && opt)
builtin_bind_var_to_int (vname, pstat.pid, bindflags);
WAIT_RETURN (EXECUTION_SUCCESS);
}
Vendored
+14 -12
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.2, version 5.039.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for bash 5.2-alpha.
# Generated by GNU Autoconf 2.71 for bash 5.2-beta.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -612,8 +612,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.2-alpha'
PACKAGE_STRING='bash 5.2-alpha'
PACKAGE_VERSION='5.2-beta'
PACKAGE_STRING='bash 5.2-beta'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1467,7 +1467,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bash 5.2-alpha to adapt to many kinds of systems.
\`configure' configures bash 5.2-beta to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1533,7 +1533,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.2-alpha:";;
short | recursive ) echo "Configuration of bash 5.2-beta:";;
esac
cat <<\_ACEOF
@@ -1740,7 +1740,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.2-alpha
bash configure 5.2-beta
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2397,7 +2397,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash $as_me 5.2-alpha, which was
It was created by bash $as_me 5.2-beta, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3176,7 +3176,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=5.2
RELSTATUS=alpha
RELSTATUS=beta
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -5960,7 +5960,8 @@ elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=
TERMCAP_DEP=
else
TERMCAP_LIB=-lcurses
# we assume ncurses is installed somewhere the linker can find it
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
fi
@@ -21546,7 +21547,8 @@ elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=
TERMCAP_DEP=
else
TERMCAP_LIB=-lcurses
# we assume ncurses is installed somewhere the linker can find it
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
fi
@@ -22330,7 +22332,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bash $as_me 5.2-alpha, which was
This file was extended by bash $as_me 5.2-beta, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22398,7 +22400,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
bash config.status 5.2-alpha
bash config.status 5.2-beta
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
+1 -1
View File
@@ -24,7 +24,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_REVISION([for Bash 5.2, version 5.039])dnl
define(bashvers, 5.2)
define(relstatus, alpha)
define(relstatus, beta)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
+506 -460
View File
File diff suppressed because it is too large Load Diff
+81 -27
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Sun Dec 26 16:02:07 EST 2021
.\" Last Change: Fri Mar 11 10:16:50 EST 2022
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2021 December 26" "GNU Bash 5.2"
.TH BASH 1 "2022 March 11" "GNU Bash 5.2"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -50,8 +50,8 @@ bash \- GNU Bourne-Again SHell
[options]
[command_string | file]
.SH COPYRIGHT
.if n Bash is Copyright (C) 1989-2021 by the Free Software Foundation, Inc.
.if t Bash is Copyright \(co 1989-2021 by the Free Software Foundation, Inc.
.if n Bash is Copyright (C) 1989-2022 by the Free Software Foundation, Inc.
.if t Bash is Copyright \(co 1989-2022 by the Free Software Foundation, Inc.
.SH DESCRIPTION
.B Bash
is an \fBsh\fR-compatible command language interpreter that
@@ -1308,7 +1308,7 @@ to a shell variable or array index, the += operator can be used to
append to or add to the variable's previous value.
This includes arguments to builtin commands such as \fBdeclare\fP that
accept assignment statements (\fIdeclaration\fP commands).
When += is applied to a variable for which the \fIinteger\fP attribute has been
When += is applied to a variable for which the \fBinteger\fP attribute has been
set, \fIvalue\fP is evaluated as an arithmetic expression and added to the
variable's current value, which is also evaluated.
When += is applied to an array variable using compound assignment (see
@@ -2084,7 +2084,7 @@ below.
The value is used to set the shell's compatibility level.
See
.SM
.B SHELL COMPATIBILITY MODE
.B "SHELL COMPATIBILITY MODE"
below for a description of the various compatibility
levels and their effects.
The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
@@ -2097,7 +2097,7 @@ compatibility level to the default for the current version.
The valid values correspond to the compatibility levels
described below under
.SM
.BR BSHELL COMPATIBILITY MODE .
.BR "SHELL COMPATIBILITY MODE" .
For example, 4.2 and 42 are valid values that correspond
to the \fBcompat42\fP \fBshopt\fP option
and set the compatibility level to 42.
@@ -2774,6 +2774,12 @@ interpreted as relative to one greater than the maximum index of
\fIname\fP, so negative indices count back from the end of the
array, and an index of \-1 references the last element.
.PP
The += operator will append to an array variable when assigning
using the compound assignment syntax; see
.SM
.B PARAMETERS
above.
.PP
Any element of an array may be referenced using
${\fIname\fP[\fIsubscript\fP]}. The braces are required to avoid
conflicts with pathname expansion. If
@@ -3170,7 +3176,7 @@ ${\fIparameter\fP\fB:\fP\fIoffset\fP\fB:\fP\fIlength\fP}
\fBSubstring Expansion\fP.
Expands to up to \fIlength\fP characters of the value of \fIparameter\fP
starting at the character specified by \fIoffset\fP.
If \fIparameter\fP is \fB@\fP, an indexed array subscripted by
If \fIparameter\fP is \fB@\fP or \fB*\fP, an indexed array subscripted by
\fB@\fP or \fB*\fP, or an associative array name, the results differ as
described below.
If \fIlength\fP is omitted, expands to the substring of the value of
@@ -3193,8 +3199,8 @@ a number of characters, and the expansion is the characters between
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the \fB:-\fP expansion.
.sp 1
If \fIparameter\fP is \fB@\fP, the result is \fIlength\fP positional
parameters beginning at \fIoffset\fP.
If \fIparameter\fP is \fB@\fP or \fB*\fP, the result is \fIlength\fP
positional parameters beginning at \fIoffset\fP.
A negative \fIoffset\fP is taken relative to one greater than the greatest
positional parameter, so an offset of \-1 evaluates to the last positional
parameter.
@@ -3373,18 +3379,27 @@ matches of \fIpattern\fP are deleted.
If \fIstring\fP is null,
matches of \fIpattern\fP are deleted
and the \fB/\fP following \fIpattern\fP may be omitted.
.sp 1
If the \fBpatsub_replacement\fP shell option is enabled using \fBshopt\fP,
any unquoted instances of \fB&\fP in \fIstring\fP are replaced with the
matching portion of \fIpattern\fP.
Backslash is used to quote \fB&\fP in \fIstring\fP; the backslash is removed
.sp 1
Quoting any part of \fIstring\fP inhibits replacement in the
expansion of the quoted portion, including replacement strings stored
in shell variables.
Backslash will escape \fB&\fP in \fIstring\fP; the backslash is removed
in order to permit a literal \fB&\fP in the replacement string.
Users should take care
if \fIstring\fP is double-quoted to avoid unwanted interactions between
the backslash and double-quoting.
Pattern substitution performs the check for \fB&\fP after expanding
\fIstring\fP; shell programmers should quote backslashes intended to escape
the \fB&\fP and inhibit replacement so they survive any quote removal
performed by the expansion of \fIstring\fP.
Backslash can also be used to escape a backslash; \fB\e\e\fP results in
a literal backslash in the replacement.
Users should take care if \fIstring\fP is double-quoted to avoid
unwanted interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes.
Pattern substitution performs the check for unquoted \fB&\fP after
expanding \fIstring\fP;
shell programmers should quote any occurrences of \fB&\fP
they want to be taken literally in the replacement
and ensure any instances of \fB&\fP they want to be replaced are unquoted.
.sp 1
If the
.B nocasematch
shell option is enabled, the match is performed without regard to the case
@@ -4486,11 +4501,22 @@ been enabled.
.PP
Variables local to the function may be declared with the
.B local
builtin command. Ordinarily, variables and their values
builtin command (\fIlocal variables\fP).
Ordinarily, variables and their values
are shared between the function and its caller.
If a variable is declared \fBlocal\fP, the variable's visible scope
is restricted to that function and its children (including the functions
it calls).
.PP
In the following description, the \fIcurrent scope\fP is a currently-
executing function.
Previous scopes consist of that function's caller and so on,
back to the "global" scope, where the shell is not executing
any shell function.
Consequently, a local variable at the current scope is a variable
declared using the \fBlocal\fP or \fBdeclare\fP builtins in the
function that is currently executing.
.PP
Local variables "shadow" variables with the same name declared at
previous scopes.
For instance, a local variable declared in a function
@@ -4521,11 +4547,13 @@ variable is local to the current scope, \fBunset\fP will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the current local scope is unset, it will remain so
(appearing as unset)
until it is reset in that scope or until the function returns.
Once the function returns, any instance of the variable at a previous
scope will become visible.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
variable with that name that had been shadowed will become visible
(see below how the \fBlocalvar_unset\fP shell option changes this behavior).
.PP
The \fBFUNCNEST\fP variable, if set to a numeric value greater
than 0, defines a maximum function nesting level. Function
@@ -5909,6 +5937,30 @@ The variables and their default values are:
.PP
.PD 0
.TP
.B active\-region\-start\-color
A string variable that controls the text color and background when displaying
the text in the active region (see the description of
\fBenable\-active\-region\fP below).
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal before displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that puts the terminal in standout mode,
as obtained from the terminal's terminfo description.
A sample value might be \f(CW"\ee[01;33m"\fP.
.TP
.B active\-region\-end\-color
A string variable that "undoes" the effects of \fBactive\-region\-start\-color\fP
and restores "normal" terminal display appearance after displaying text
in the active region.
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal after displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that restores the terminal from standout mode,
as obtained from the terminal's terminfo description.
A sample value might be \f(CW"\ee[0m"\fP.
.TP
.B bell\-style (audible)
Controls what happens when readline wants to ring the terminal bell.
If set to \fBnone\fP, readline never rings the bell. If set to
@@ -6028,16 +6080,18 @@ The text between the point and mark is referred to as the \fIregion\fP.
When this variable is set to \fIOn\fP, readline allows certain commands
to designate the region as \fIactive\fP.
When the region is active, readline highlights the text in the region using
the value of the \fBactive\-region\-start\-color\fP, which defaults to the
string that enables
the terminal's standout mode.
The active region shows the text inserted by bracketed-paste and any
matching text found by incremental and non-incremental history searches.
.TP
.B enable\-bracketed\-paste (On)
When set to \fBOn\fP, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
from being interpreted as editing commands.
When set to \fBOn\fP, readline configures the terminal to insert each
paste into the editing buffer as a single string of characters, instead
of treating each character as if it had been read from the keyboard.
This prevents readline from executing any editing commands bound to key
sequences appearing in the pasted text.
.TP
.B enable\-keypad (Off)
When set to \fBOn\fP, readline will try to enable the application
@@ -11171,8 +11225,8 @@ specifies a non-existent process or job, the return status is
127. Otherwise, the return status is the exit status of the last
process or job waited for.
.SH "SHELL COMPATIBILITY MODE"
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
Bash-4.0 introduced the concept of a \fIshell compatibility level\fP,
specified as a set of options to the shopt builtin (
.BR compat31 ,
.BR compat32 ,
.BR compat40 ,
+87 -27
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2021 December 26<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2022 March 11<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -54,7 +54,7 @@ bash - GNU Bourne-Again SHell
<H3>COPYRIGHT</H3>
Bash is Copyright &#169; 1989-2021 by the Free Software Foundation, Inc.
Bash is Copyright &#169; 1989-2022 by the Free Software Foundation, Inc.
<A NAME="lbAE">&nbsp;</A>
<H3>DESCRIPTION</H3>
@@ -1680,7 +1680,7 @@ to a shell variable or array index, the += operator can be used to
append to or add to the variable's previous value.
This includes arguments to builtin commands such as <B>declare</B> that
accept assignment statements (<I>declaration</I> commands).
When += is applied to a variable for which the <I>integer</I> attribute has been
When += is applied to a variable for which the <B>integer</B> attribute has been
set, <I>value</I> is evaluated as an arithmetic expression and added to the
variable's current value, which is also evaluated.
When += is applied to an array variable using compound assignment (see
@@ -2660,7 +2660,7 @@ compatibility levels, the shell prints an error message and sets the
compatibility level to the default for the current version.
The valid values correspond to the compatibility levels
described below under
<FONT SIZE=-1><B>BSHELL</B>COMPATIBILITY<B>MODE</B>.
<FONT SIZE=-1><B>SHELL COMPATIBILITY MODE</B>.
</FONT>
For example, 4.2 and 42 are valid values that correspond
@@ -3503,6 +3503,14 @@ interpreted as relative to one greater than the maximum index of
array, and an index of -1 references the last element.
<P>
The += operator will append to an array variable when assigning
using the compound assignment syntax; see
<FONT SIZE=-1><B>PARAMETERS</B>
</FONT>
above.
<P>
Any element of an array may be referenced using
${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
conflicts with pathname expansion. If
@@ -3995,7 +4003,7 @@ is substituted.
<B>Substring Expansion</B>.
Expands to up to <I>length</I> characters of the value of <I>parameter</I>
starting at the character specified by <I>offset</I>.
If <I>parameter</I> is <B>@</B>, an indexed array subscripted by
If <I>parameter</I> is <B>@</B> or <B>*</B>, an indexed array subscripted by
<B>@</B> or <B>*</B>, or an associative array name, the results differ as
described below.
If <I>length</I> is omitted, expands to the substring of the value of
@@ -4018,8 +4026,8 @@ a number of characters, and the expansion is the characters between
Note that a negative offset must be separated from the colon by at least
one space to avoid being confused with the <B>:-</B> expansion.
<P>
If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
parameters beginning at <I>offset</I>.
If <I>parameter</I> is <B>@</B> or <B>*</B>, the result is <I>length</I>
positional parameters beginning at <I>offset</I>.
A negative <I>offset</I> is taken relative to one greater than the greatest
positional parameter, so an offset of -1 evaluates to the last positional
parameter.
@@ -4215,18 +4223,27 @@ matches of <I>pattern</I> are deleted.
If <I>string</I> is null,
matches of <I>pattern</I> are deleted
and the <B>/</B> following <I>pattern</I> may be omitted.
<P>
If the <B>patsub_replacement</B> shell option is enabled using <B>shopt</B>,
any unquoted instances of <B>&amp;</B> in <I>string</I> are replaced with the
matching portion of <I>pattern</I>.
Backslash is used to quote <B>&amp;</B> in <I>string</I>; the backslash is removed
<P>
Quoting any part of <I>string</I> inhibits replacement in the
expansion of the quoted portion, including replacement strings stored
in shell variables.
Backslash will escape <B>&amp;</B> in <I>string</I>; the backslash is removed
in order to permit a literal <B>&amp;</B> in the replacement string.
Users should take care
if <I>string</I> is double-quoted to avoid unwanted interactions between
the backslash and double-quoting.
Pattern substitution performs the check for <B>&amp;</B> after expanding
<I>string</I>; shell programmers should quote backslashes intended to escape
the <B>&amp;</B> and inhibit replacement so they survive any quote removal
performed by the expansion of <I>string</I>.
Backslash can also be used to escape a backslash; <B>\\</B> results in
a literal backslash in the replacement.
Users should take care if <I>string</I> is double-quoted to avoid
unwanted interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes.
Pattern substitution performs the check for unquoted <B>&amp;</B> after
expanding <I>string</I>;
shell programmers should quote any occurrences of <B>&amp;</B>
they want to be taken literally in the replacement
and ensure any instances of <B>&amp;</B> they want to be replaced are unquoted.
<P>
If the
<B>nocasematch</B>
@@ -5684,11 +5701,24 @@ been enabled.
Variables local to the function may be declared with the
<B>local</B>
builtin command. Ordinarily, variables and their values
builtin command (<I>local variables</I>).
Ordinarily, variables and their values
are shared between the function and its caller.
If a variable is declared <B>local</B>, the variable's visible scope
is restricted to that function and its children (including the functions
it calls).
<P>
In the following description, the <I>current scope</I> is a currently-
executing function.
Previous scopes consist of that function's caller and so on,
back to the &quot;global&quot; scope, where the shell is not executing
any shell function.
Consequently, a local variable at the current scope is a variable
declared using the <B>local</B> or <B>declare</B> builtins in the
function that is currently executing.
<P>
Local variables &quot;shadow&quot; variables with the same name declared at
previous scopes.
For instance, a local variable declared in a function
@@ -5722,11 +5752,13 @@ variable is local to the current scope, <B>unset</B> will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the current local scope is unset, it will remain so
(appearing as unset)
until it is reset in that scope or until the function returns.
Once the function returns, any instance of the variable at a previous
scope will become visible.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
variable with that name that had been shadowed will become visible
(see below how the <B>localvar_unset</B> shell option changes this behavior).
<P>
The <B>FUNCNEST</B> variable, if set to a numeric value greater
@@ -7527,6 +7559,32 @@ The variables and their default values are:
<DL COMPACT>
<DT><B>active-region-start-color </B>
<DD>
A string variable that controls the text color and background when displaying
the text in the active region (see the description of
<B>enable-active-region</B> below).
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal before displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that puts the terminal in standout mode,
as obtained from the terminal's terminfo description.
A sample value might be <TT>&quot;\e[01;33m&quot;</TT>.
<DT><B>active-region-end-color </B>
<DD>
A string variable that &quot;undoes&quot; the effects of <B>active-region-start-color</B>
and restores &quot;normal&quot; terminal display appearance after displaying text
in the active region.
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal after displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that restores the terminal from standout mode,
as obtained from the terminal's terminfo description.
A sample value might be <TT>&quot;\e[0m&quot;</TT>.
<DT><B>bell-style (audible)</B>
<DD>
@@ -7670,17 +7728,19 @@ The text between the point and mark is referred to as the <I>region</I>.
When this variable is set to <I>On</I>, readline allows certain commands
to designate the region as <I>active</I>.
When the region is active, readline highlights the text in the region using
the value of the <B>active-region-start-color</B>, which defaults to the
string that enables
the terminal's standout mode.
The active region shows the text inserted by bracketed-paste and any
matching text found by incremental and non-incremental history searches.
<DT><B>enable-bracketed-paste (On)</B>
<DD>
When set to <B>On</B>, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
from being interpreted as editing commands.
When set to <B>On</B>, readline configures the terminal to insert each
paste into the editing buffer as a single string of characters, instead
of treating each character as if it had been read from the keyboard.
This prevents readline from executing any editing commands bound to key
sequences appearing in the pasted text.
<DT><B>enable-keypad (Off)</B>
<DD>
@@ -14079,8 +14139,8 @@ process or job waited for.
<A NAME="lbDC">&nbsp;</A>
<H3>SHELL COMPATIBILITY MODE</H3>
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
Bash-4.0 introduced the concept of a <I>shell compatibility level</I>,
specified as a set of options to the shopt builtin (
<B>compat31</B>,
<B>compat32</B>,
@@ -14617,7 +14677,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash 5.2<TH ALIGN=CENTER width=33%>2021 December 26<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash 5.2<TH ALIGN=CENTER width=33%>2022 March 11<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -14723,7 +14783,7 @@ There may be only one active coprocess at a time.
<DT><A HREF="#lbDI">BUGS</A><DD>
</DL>
<HR>
This document was created by man2html from /usr/local/src/bash/bash-20220105/doc/bash.1.<BR>
Time: 11 January 2022 15:02:14 EST
This document was created by man2html from bash.1.<BR>
Time: 08 April 2022 15:46:17 EDT
</BODY>
</HTML>
+325 -253
View File
@@ -1,12 +1,12 @@
This is bash.info, produced by makeinfo version 6.8 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 26 December 2021).
Bash shell (version 5.2, 24 February 2022).
This is Edition 5.2, last updated 26 December 2021, of 'The GNU Bash
This is Edition 5.2, last updated 24 February 2022, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
@@ -26,10 +26,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 26 December 2021). The Bash home page is
Bash shell (version 5.2, 24 February 2022). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.2, last updated 26 December 2021, of 'The GNU Bash
This is Edition 5.2, last updated 24 February 2022, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Bash contains features that appear in other popular shells, and some
@@ -1367,9 +1367,17 @@ status; otherwise the function's return status is the exit status of the
last command executed before the 'return'.
Variables local to the function may be declared with the 'local'
builtin. These variables are visible only to the function and the
commands it invokes. This is particularly important when a shell
function calls other functions.
builtin ("local variables"). Ordinarily, variables and their values are
shared between a function and its caller. These variables are visible
only to the function and the commands it invokes. This is particularly
important when a shell function calls other functions.
In the following description, the "current scope" is a currently-
executing function. Previous scopes consist of that function's caller
and so on, back to the "global" scope, where the shell is not executing
any shell function. Consequently, a local variable at the current local
scope is a variable declared using the 'local' or 'declare' builtins in
the function that is currently executing.
Local variables "shadow" variables with the same name declared at
previous scopes. For instance, a local variable declared in a function
@@ -1414,11 +1422,12 @@ script displays
variable is local to the current scope, 'unset' will unset it; otherwise
the unset will refer to the variable found in any calling scope as
described above. If a variable at the current local scope is unset, it
will remain so until it is reset in that scope or until the function
returns. Once the function returns, any instance of the variable at a
previous scope will become visible. If the unset acts on a variable at
a previous scope, any instance of a variable with that name that had
been shadowed will become visible.
will remain so (appearing as unset) until it is reset in that scope or
until the function returns. Once the function returns, any instance of
the variable at a previous scope will become visible. If the unset acts
on a variable at a previous scope, any instance of a variable with that
name that had been shadowed will become visible (see below how
'localvar_unset'shell option changes this behavior).
Function names and definitions may be listed with the '-f' option to
the 'declare' ('typeset') builtin command (*note Bash Builtins::). The
@@ -1867,11 +1876,11 @@ omitted, the operator tests only for existence.
'${PARAMETER:OFFSET:LENGTH}'
This is referred to as Substring Expansion. It expands to up to
LENGTH characters of the value of PARAMETER starting at the
character specified by OFFSET. If PARAMETER is '@', an indexed
array subscripted by '@' or '*', or an associative array name, the
results differ as described below. If LENGTH is omitted, it
expands to the substring of the value of PARAMETER starting at the
character specified by OFFSET and extending to the end of the
character specified by OFFSET. If PARAMETER is '@' or '*', an
indexed array subscripted by '@' or '*', or an associative array
name, the results differ as described below. If LENGTH is omitted,
it expands to the substring of the value of PARAMETER starting at
the character specified by OFFSET and extending to the end of the
value. LENGTH and OFFSET are arithmetic expressions (*note Shell
Arithmetic::).
@@ -1939,11 +1948,11 @@ omitted, the operator tests only for existence.
$ echo ${array[0]: -7:-2}
bcdef
If PARAMETER is '@', the result is LENGTH positional parameters
beginning at OFFSET. A negative OFFSET is taken relative to one
greater than the greatest positional parameter, so an offset of -1
evaluates to the last positional parameter. It is an expansion
error if LENGTH evaluates to a number less than zero.
If PARAMETER is '@' or '*', the result is LENGTH positional
parameters beginning at OFFSET. A negative OFFSET is taken
relative to one greater than the greatest positional parameter, so
an offset of -1 evaluates to the last positional parameter. It is
an expansion error if LENGTH evaluates to a number less than zero.
The following examples illustrate substring expansion using
positional parameters:
@@ -2078,38 +2087,58 @@ omitted, the operator tests only for existence.
If the 'patsub_replacement' shell option is enabled using 'shopt',
any unquoted instances of '&' in STRING are replaced with the
matching portion of PATTERN. This is intended to duplicate a
common 'sed' idiom. Backslash is used to quote '&' in STRING; the
backslash is removed in order to permit a literal '&' in the
replacement string. Pattern substitution performs the check for
'&' after expanding STRING, so users should take care to quote
backslashes intended to escape the '&' and inhibit replacement so
they survive any quote removal performed by the expansion of
STRING. For instance,
common 'sed' idiom.
Quoting any part of STRING inhibits replacement in the expansion of
the quoted portion, including replacement strings stored in shell
variables. Backslash will escape '&' in STRING; the backslash is
removed in order to permit a literal '&' in the replacement string.
Users should take care if STRING is double-quoted to avoid unwanted
interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes. Pattern
substitution performs the check for unquoted '&' after expanding
STRING, so users should ensure to properly quote any occurrences of
'&' they want to be taken literally in the replacement and ensure
any instances of '&' they want to be replaced are unquoted.
For instance,
var=abcdef
rep='& '
echo ${var/abc/& }
echo "${var/abc/& }"
echo ${var/abc/"& "}
echo ${var/abc/$rep}
echo "${var/abc/$rep}"
will display three lines of "abc def", while
will display four lines of "abc def", while
var=abcdef
rep='& '
echo ${var/abc/\& }
echo "${var/abc/\& }"
echo ${var/abc/"\& "}
echo ${var/abc/"& "}
echo ${var/abc/"$rep"}
will display two lines of "abc def" and a third line of "& def".
The first two are replaced because the backslash is removed by
quote removal performed during the expansion of STRING (the
expansion is performed in a context that doesn't take any enclosing
double quotes into account, as with other word expansions). In the
third case, the double quotes affect the expansion of '\&', and,
because '&' is not one of the characters for which backslash is
special in double quotes, the backslash survives the expansion,
inhibits the replacement, but is removed because it is treated
specially. One could use '\\&', unquoted, as the replacement
string to achive the same effect. It should rarely be necessary to
enclose only STRING in double quotes.
will display four lines of "& def". Like the pattern removal
operators, double quotes surrounding the replacement string quote
the expanded characters, while double quotes enclosing the entire
parameter substitution do not, since the expansion is performed in
a context that doesn't take any enclosing double quotes into
account.
Since backslash can escape '&', it can also escape a backslash in
the replacement string. This means that '\\' will insert a literal
backslash into the replacement, so these two 'echo' commands
var=abcdef
rep='\\&xyz'
echo ${var/abc/\\&xyz}
echo ${var/abc/$rep}
will both output '\abcxyzdef'.
It should rarely be necessary to enclose only STRING in double
quotes.
If the 'nocasematch' shell option (see the description of 'shopt'
in *note The Shopt Builtin::) is enabled, the match is performed
@@ -6640,6 +6669,10 @@ negative number, that number is interpreted as relative to one greater
than the maximum index of NAME, so negative indices count back from the
end of the array, and an index of -1 references the last element.
The '+=' operator will append to an array variable when assigning
using the compound assignment syntax; see *note Shell Parameters::
above.
Any element of an array may be referenced using '${NAME[SUBSCRIPT]}'.
The braces are required to avoid conflicts with the shell's filename
expansion operators. If the SUBSCRIPT is '@' or '*', the word expands
@@ -7008,73 +7041,80 @@ startup files.
7. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
8. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
8. Alias expansion is performed when initially parsing a command
substitution. The default mode generally defers it, when enabled,
until the command substitution is executed. This means that
command substitution will not expand aliases that are defined after
the command substitution is initially parsed (e.g., as part of a
function definition).
9. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
and '!!' to '!' are enabled, and parameter expansion is performed
on the values of 'PS1' and 'PS2' regardless of the setting of the
'promptvars' option.
9. The POSIX startup files are executed ('$ENV') rather than the
10. The POSIX startup files are executed ('$ENV') rather than the
normal Bash files.
10. Tilde expansion is only performed on assignments preceding a
11. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
11. The default history file is '~/.sh_history' (this is the default
12. The default history file is '~/.sh_history' (this is the default
value of '$HISTFILE').
12. Redirection operators do not perform filename expansion on the
13. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
13. Redirection operators do not perform word splitting on the word in
14. Redirection operators do not perform word splitting on the word in
the redirection.
14. Function names must be valid shell 'name's. That is, they may not
15. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
15. Function names may not be the same as one of the POSIX special
16. Function names may not be the same as one of the POSIX special
builtins.
16. POSIX special builtins are found before shell functions during
17. POSIX special builtins are found before shell functions during
command lookup.
17. When printing shell function definitions (e.g., by 'type'), Bash
18. When printing shell function definitions (e.g., by 'type'), Bash
does not print the 'function' keyword.
18. Literal tildes that appear as the first character in elements of
19. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
19. The 'time' reserved word may be used by itself as a command. When
20. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
20. When parsing and expanding a ${...} expansion that appears within
21. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
21. The parser does not recognize 'time' as a reserved word if the
22. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
22. The '!' character does not introduce history expansion within a
23. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
23. If a POSIX special builtin returns an error status, a
24. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
24. A non-interactive shell exits with an error status if a variable
25. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
25. A non-interactive shell exits with an error status if a variable
26. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command. For any
other simple command, the shell aborts execution of that command,
@@ -7082,133 +7122,133 @@ startup files.
perform any further processing of the command in which the error
occurred").
26. A non-interactive shell exits with an error status if the
27. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
27. Non-interactive shells exit if FILENAME in '.' FILENAME is not
28. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
28. Non-interactive shells exit if a syntax error in an arithmetic
29. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
29. Non-interactive shells exit if a parameter expansion error occurs.
30. Non-interactive shells exit if a parameter expansion error occurs.
30. Non-interactive shells exit if there is a syntax error in a script
31. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
31. While variable indirection is available, it may not be applied to
32. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
32. When expanding the '*' special parameter in a pattern context
33. When expanding the '*' special parameter in a pattern context
where the expansion is double-quoted does not treat the '$*' as if
it were double-quoted.
33. Assignment statements preceding POSIX special builtins persist in
34. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
34. The 'command' builtin does not prevent builtins that take
35. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
35. The 'bg' builtin uses the required format to describe each job
36. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
36. The output of 'kill -l' prints all the signal names on a single
37. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
37. The 'kill' builtin does not accept signal names with a 'SIG'
38. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
38. The 'export' and 'readonly' builtin commands display their output
39. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
39. The 'trap' builtin displays signal names without the leading
40. The 'trap' builtin displays signal names without the leading
'SIG'.
40. The 'trap' builtin doesn't check the first argument for a possible
41. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
41. 'trap -p' displays signals whose dispositions are set to SIG_DFL
42. 'trap -p' displays signals whose dispositions are set to SIG_DFL
and those that were ignored when the shell started.
42. The '.' and 'source' builtins do not search the current directory
43. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
43. Enabling POSIX mode has the effect of setting the
44. Enabling POSIX mode has the effect of setting the
'inherit_errexit' option, so subshells spawned to execute command
substitutions inherit the value of the '-e' option from the parent
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
44. Enabling POSIX mode has the effect of setting the 'shift_verbose'
45. Enabling POSIX mode has the effect of setting the 'shift_verbose'
option, so numeric arguments to 'shift' that exceed the number of
positional parameters will result in an error message.
45. When the 'alias' builtin displays alias definitions, it does not
46. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
46. When the 'set' builtin is invoked without options, it does not
47. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
47. When the 'set' builtin is invoked without options, it displays
48. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
48. When the 'cd' builtin is invoked in logical mode, and the pathname
49. When the 'cd' builtin is invoked in logical mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to physical mode.
49. When the 'cd' builtin cannot change a directory because the length
50. When the 'cd' builtin cannot change a directory because the length
of the pathname constructed from '$PWD' and the directory name
supplied as an argument exceeds 'PATH_MAX' when all symbolic links
are expanded, 'cd' will fail instead of attempting to use only the
supplied directory name.
50. The 'pwd' builtin verifies that the value it prints is the same as
51. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
51. When listing the history, the 'fc' builtin does not include an
52. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
52. The default editor used by 'fc' is 'ed'.
53. The default editor used by 'fc' is 'ed'.
53. The 'type' and 'command' builtins will not report a non-executable
54. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
54. The 'vi' editing mode will invoke the 'vi' editor directly when
55. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
55. When the 'xpg_echo' option is enabled, Bash does not attempt to
56. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
57. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
58. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
58. The 'read' builtin may be interrupted by a signal for which a trap
59. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
59. Bash removes an exited background process's status from the list
60. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
There is other POSIX behavior that Bash does not implement by default
@@ -7231,7 +7271,7 @@ File: bash.info, Node: Shell Compatibility Mode, Prev: Bash POSIX Mode, Up: B
6.12 Shell Compatibility Mode
=============================
Bash-4.0 introduced the concept of a 'shell compatibility level',
Bash-4.0 introduced the concept of a "shell compatibility level",
specified as a set of options to the shopt builtin ('compat31',
'compat32', 'compat40', 'compat41', and so on). There is only one
current compatibility level - each option is mutually exclusive. The
@@ -7981,6 +8021,32 @@ Variable Settings
A great deal of run-time behavior is changeable with the following
variables.
'active-region-start-color'
A string variable that controls the text color and background
when displaying the text in the active region (see the
description of 'enable-active-region' below). This string
must not take up any physical character positions on the
display, so it should consist only of terminal escape
sequences. It is output to the terminal before displaying the
text in the active region. This variable is reset to the
default value whenever the terminal type changes. The default
value is the string that puts the terminal in standout mode,
as obtained from the terminal's terminfo description. A
sample value might be '\e[01;33m'.
'active-region-end-color'
A string variable that "undoes" the effects of
'active-region-start-color' and restores "normal" terminal
display appearance after displaying text in the active region.
This string must not take up any physical character positions
on the display, so it should consist only of terminal escape
sequences. It is output to the terminal after displaying the
text in the active region. This variable is reset to the
default value whenever the terminal type changes. The default
value is the string that restores the terminal from standout
mode, as obtained from the terminal's terminfo description. A
sample value might be '\e[0m'.
'bell-style'
Controls what happens when Readline wants to ring the terminal
bell. If set to 'none', Readline never rings the bell. If
@@ -8096,18 +8162,20 @@ Variable Settings
"region". When this variable is set to 'On', Readline allows
certain commands to designate the region as "active". When
the region is active, Readline highlights the text in the
region using the terminal's standout mode. The active region
shows the text inserted by bracketed-paste and any matching
text found by incremental and non-incremental history
searches. The default is 'On'.
region using the value of the 'active-region-start-color',
which defaults to the string that enables the terminal's
standout mode. The active region shows the text inserted by
bracketed-paste and any matching text found by incremental and
non-incremental history searches. The default is 'On'.
'enable-bracketed-paste'
When set to 'On', Readline will configure the terminal in a
way that will enable it to insert each paste into the editing
buffer as a single string of characters, instead of treating
each character as if it had been read from the keyboard. This
can prevent pasted characters from being interpreted as
editing commands. The default is 'On'.
When set to 'On', Readline configures the terminal to insert
each paste into the editing buffer as a single string of
characters, instead of treating each character as if it had
been read from the keyboard. This is called putting the
terminal into "bracketed paste mode"; it prevents Readline
from executing any editing commands bound to key sequences
appearing in the pasted text. The default is 'On'.
'enable-keypad'
When set to 'on', Readline will try to enable the application
@@ -11835,6 +11903,10 @@ D.3 Parameter and Variable Index
* ?: Special Parameters. (line 42)
* @: Special Parameters. (line 22)
* _: Bash Variables. (line 13)
* active-region-end-color: Readline Init File Syntax.
(line 51)
* active-region-start-color: Readline Init File Syntax.
(line 38)
* auto_resume: Job Control Variables.
(line 6)
* BASH: Bash Variables. (line 23)
@@ -11858,31 +11930,31 @@ D.3 Parameter and Variable Index
* BASH_VERSION: Bash Variables. (line 181)
* BASH_XTRACEFD: Bash Variables. (line 184)
* bell-style: Readline Init File Syntax.
(line 38)
(line 64)
* bind-tty-special-chars: Readline Init File Syntax.
(line 45)
(line 71)
* blink-matching-paren: Readline Init File Syntax.
(line 50)
(line 76)
* CDPATH: Bourne Shell Variables.
(line 9)
* CHILD_MAX: Bash Variables. (line 195)
* colored-completion-prefix: Readline Init File Syntax.
(line 55)
(line 81)
* colored-stats: Readline Init File Syntax.
(line 65)
(line 91)
* COLUMNS: Bash Variables. (line 202)
* comment-begin: Readline Init File Syntax.
(line 71)
(line 97)
* completion-display-width: Readline Init File Syntax.
(line 76)
(line 102)
* completion-ignore-case: Readline Init File Syntax.
(line 83)
(line 109)
* completion-map-case: Readline Init File Syntax.
(line 88)
(line 114)
* completion-prefix-display-length: Readline Init File Syntax.
(line 94)
(line 120)
* completion-query-items: Readline Init File Syntax.
(line 101)
(line 127)
* COMPREPLY: Bash Variables. (line 254)
* COMP_CWORD: Bash Variables. (line 208)
* COMP_KEY: Bash Variables. (line 237)
@@ -11892,31 +11964,31 @@ D.3 Parameter and Variable Index
* COMP_WORDBREAKS: Bash Variables. (line 241)
* COMP_WORDS: Bash Variables. (line 247)
* convert-meta: Readline Init File Syntax.
(line 112)
(line 138)
* COPROC: Bash Variables. (line 260)
* DIRSTACK: Bash Variables. (line 264)
* disable-completion: Readline Init File Syntax.
(line 120)
(line 146)
* echo-control-characters: Readline Init File Syntax.
(line 125)
(line 151)
* editing-mode: Readline Init File Syntax.
(line 130)
(line 156)
* EMACS: Bash Variables. (line 274)
* emacs-mode-string: Readline Init File Syntax.
(line 136)
(line 162)
* enable-active-region: Readline Init File Syntax.
(line 146)
(line 172)
* enable-bracketed-paste: Readline Init File Syntax.
(line 158)
(line 185)
* enable-keypad: Readline Init File Syntax.
(line 166)
(line 194)
* ENV: Bash Variables. (line 279)
* EPOCHREALTIME: Bash Variables. (line 284)
* EPOCHSECONDS: Bash Variables. (line 292)
* EUID: Bash Variables. (line 299)
* EXECIGNORE: Bash Variables. (line 303)
* expand-tilde: Readline Init File Syntax.
(line 177)
(line 205)
* FCEDIT: Bash Variables. (line 316)
* FIGNORE: Bash Variables. (line 320)
* FUNCNAME: Bash Variables. (line 326)
@@ -11930,15 +12002,15 @@ D.3 Parameter and Variable Index
* HISTFILESIZE: Bash Variables. (line 402)
* HISTIGNORE: Bash Variables. (line 413)
* history-preserve-point: Readline Init File Syntax.
(line 181)
(line 209)
* history-size: Readline Init File Syntax.
(line 187)
(line 215)
* HISTSIZE: Bash Variables. (line 433)
* HISTTIMEFORMAT: Bash Variables. (line 440)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 196)
(line 224)
* HOSTFILE: Bash Variables. (line 448)
* HOSTNAME: Bash Variables. (line 459)
* HOSTTYPE: Bash Variables. (line 462)
@@ -11946,13 +12018,13 @@ D.3 Parameter and Variable Index
(line 18)
* IGNOREEOF: Bash Variables. (line 465)
* input-meta: Readline Init File Syntax.
(line 205)
(line 233)
* INPUTRC: Bash Variables. (line 475)
* INSIDE_EMACS: Bash Variables. (line 479)
* isearch-terminators: Readline Init File Syntax.
(line 213)
(line 241)
* keymap: Readline Init File Syntax.
(line 220)
(line 248)
* LANG: Creating Internationalized Scripts.
(line 51)
* LANG <1>: Bash Variables. (line 485)
@@ -11974,15 +12046,15 @@ D.3 Parameter and Variable Index
(line 27)
* MAPFILE: Bash Variables. (line 540)
* mark-modified-lines: Readline Init File Syntax.
(line 250)
(line 278)
* mark-symlinked-directories: Readline Init File Syntax.
(line 255)
(line 283)
* match-hidden-files: Readline Init File Syntax.
(line 260)
(line 288)
* menu-complete-display-prefix: Readline Init File Syntax.
(line 267)
(line 295)
* meta-flag: Readline Init File Syntax.
(line 205)
(line 233)
* OLDPWD: Bash Variables. (line 544)
* OPTARG: Bourne Shell Variables.
(line 34)
@@ -11991,9 +12063,9 @@ D.3 Parameter and Variable Index
(line 38)
* OSTYPE: Bash Variables. (line 551)
* output-meta: Readline Init File Syntax.
(line 272)
(line 300)
* page-completions: Readline Init File Syntax.
(line 278)
(line 306)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 554)
@@ -12016,19 +12088,19 @@ D.3 Parameter and Variable Index
* READLINE_POINT: Bash Variables. (line 626)
* REPLY: Bash Variables. (line 630)
* revert-all-at-newline: Readline Init File Syntax.
(line 288)
(line 316)
* SECONDS: Bash Variables. (line 633)
* SHELL: Bash Variables. (line 642)
* SHELLOPTS: Bash Variables. (line 647)
* SHLVL: Bash Variables. (line 656)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 294)
(line 322)
* show-all-if-unmodified: Readline Init File Syntax.
(line 300)
(line 328)
* show-mode-in-prompt: Readline Init File Syntax.
(line 309)
(line 337)
* skip-completed-text: Readline Init File Syntax.
(line 315)
(line 343)
* SRANDOM: Bash Variables. (line 661)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
@@ -12039,11 +12111,11 @@ D.3 Parameter and Variable Index
* TMPDIR: Bash Variables. (line 720)
* UID: Bash Variables. (line 724)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 328)
(line 356)
* vi-ins-mode-string: Readline Init File Syntax.
(line 339)
(line 367)
* visible-stats: Readline Init File Syntax.
(line 350)
(line 378)

File: bash.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
@@ -12450,110 +12522,110 @@ Node: Command Grouping48823
Node: Coprocesses50298
Node: GNU Parallel52958
Node: Shell Functions53872
Node: Shell Parameters61160
Node: Positional Parameters65545
Node: Special Parameters66444
Node: Shell Expansions69655
Node: Brace Expansion71779
Node: Tilde Expansion74510
Node: Shell Parameter Expansion77128
Node: Command Substitution94991
Node: Arithmetic Expansion96343
Node: Process Substitution97308
Node: Word Splitting98425
Node: Filename Expansion100366
Node: Pattern Matching103112
Node: Quote Removal107717
Node: Redirections108009
Node: Executing Commands117666
Node: Simple Command Expansion118333
Node: Command Search and Execution120440
Node: Command Execution Environment122815
Node: Environment125847
Node: Exit Status127507
Node: Signals129288
Node: Shell Scripts132734
Node: Shell Builtin Commands135758
Node: Bourne Shell Builtins137793
Node: Bash Builtins159251
Node: Modifying Shell Behavior190104
Node: The Set Builtin190446
Node: The Shopt Builtin201044
Node: Special Builtins216953
Node: Shell Variables217929
Node: Bourne Shell Variables218363
Node: Bash Variables220464
Node: Bash Features253277
Node: Invoking Bash254287
Node: Bash Startup Files260297
Node: Interactive Shells265397
Node: What is an Interactive Shell?265804
Node: Is this Shell Interactive?266450
Node: Interactive Shell Behavior267262
Node: Bash Conditional Expressions270888
Node: Shell Arithmetic275527
Node: Aliases278468
Node: Arrays281078
Node: The Directory Stack287322
Node: Directory Stack Builtins288103
Node: Controlling the Prompt292360
Node: The Restricted Shell295322
Node: Bash POSIX Mode297929
Node: Shell Compatibility Mode309199
Node: Job Control317225
Node: Job Control Basics317682
Node: Job Control Builtins322681
Node: Job Control Variables328078
Node: Command Line Editing329231
Node: Introduction and Notation330899
Node: Readline Interaction332519
Node: Readline Bare Essentials333707
Node: Readline Movement Commands335487
Node: Readline Killing Commands336444
Node: Readline Arguments338359
Node: Searching339400
Node: Readline Init File341583
Node: Readline Init File Syntax342841
Node: Conditional Init Constructs364326
Node: Sample Init File368519
Node: Bindable Readline Commands371640
Node: Commands For Moving372841
Node: Commands For History374889
Node: Commands For Text379880
Node: Commands For Killing383526
Node: Numeric Arguments386556
Node: Commands For Completion387692
Node: Keyboard Macros391880
Node: Miscellaneous Commands392564
Node: Readline vi Mode398500
Node: Programmable Completion399404
Node: Programmable Completion Builtins407181
Node: A Programmable Completion Example417873
Node: Using History Interactively423117
Node: Bash History Facilities423798
Node: Bash History Builtins426800
Node: History Interaction431805
Node: Event Designators435422
Node: Word Designators436773
Node: Modifiers438530
Node: Installing Bash440338
Node: Basic Installation441472
Node: Compilers and Options445191
Node: Compiling For Multiple Architectures445929
Node: Installation Names447619
Node: Specifying the System Type449725
Node: Sharing Defaults450438
Node: Operation Controls451108
Node: Optional Features452063
Node: Reporting Bugs463278
Node: Major Differences From The Bourne Shell464550
Node: GNU Free Documentation License481397
Node: Indexes506571
Node: Builtin Index507022
Node: Reserved Word Index513846
Node: Variable Index516291
Node: Function Index532780
Node: Concept Index546561
Node: Shell Parameters61754
Node: Positional Parameters66139
Node: Special Parameters67038
Node: Shell Expansions70249
Node: Brace Expansion72373
Node: Tilde Expansion75104
Node: Shell Parameter Expansion77722
Node: Command Substitution96070
Node: Arithmetic Expansion97422
Node: Process Substitution98387
Node: Word Splitting99504
Node: Filename Expansion101445
Node: Pattern Matching104191
Node: Quote Removal108796
Node: Redirections109088
Node: Executing Commands118745
Node: Simple Command Expansion119412
Node: Command Search and Execution121519
Node: Command Execution Environment123894
Node: Environment126926
Node: Exit Status128586
Node: Signals130367
Node: Shell Scripts133813
Node: Shell Builtin Commands136837
Node: Bourne Shell Builtins138872
Node: Bash Builtins160330
Node: Modifying Shell Behavior191183
Node: The Set Builtin191525
Node: The Shopt Builtin202123
Node: Special Builtins218032
Node: Shell Variables219008
Node: Bourne Shell Variables219442
Node: Bash Variables221543
Node: Bash Features254356
Node: Invoking Bash255366
Node: Bash Startup Files261376
Node: Interactive Shells266476
Node: What is an Interactive Shell?266883
Node: Is this Shell Interactive?267529
Node: Interactive Shell Behavior268341
Node: Bash Conditional Expressions271967
Node: Shell Arithmetic276606
Node: Aliases279547
Node: Arrays282157
Node: The Directory Stack288545
Node: Directory Stack Builtins289326
Node: Controlling the Prompt293583
Node: The Restricted Shell296545
Node: Bash POSIX Mode299152
Node: Shell Compatibility Mode310799
Node: Job Control318825
Node: Job Control Basics319282
Node: Job Control Builtins324281
Node: Job Control Variables329678
Node: Command Line Editing330831
Node: Introduction and Notation332499
Node: Readline Interaction334119
Node: Readline Bare Essentials335307
Node: Readline Movement Commands337087
Node: Readline Killing Commands338044
Node: Readline Arguments339959
Node: Searching341000
Node: Readline Init File343183
Node: Readline Init File Syntax344441
Node: Conditional Init Constructs367637
Node: Sample Init File371830
Node: Bindable Readline Commands374951
Node: Commands For Moving376152
Node: Commands For History378200
Node: Commands For Text383191
Node: Commands For Killing386837
Node: Numeric Arguments389867
Node: Commands For Completion391003
Node: Keyboard Macros395191
Node: Miscellaneous Commands395875
Node: Readline vi Mode401811
Node: Programmable Completion402715
Node: Programmable Completion Builtins410492
Node: A Programmable Completion Example421184
Node: Using History Interactively426428
Node: Bash History Facilities427109
Node: Bash History Builtins430111
Node: History Interaction435116
Node: Event Designators438733
Node: Word Designators440084
Node: Modifiers441841
Node: Installing Bash443649
Node: Basic Installation444783
Node: Compilers and Options448502
Node: Compiling For Multiple Architectures449240
Node: Installation Names450930
Node: Specifying the System Type453036
Node: Sharing Defaults453749
Node: Operation Controls454419
Node: Optional Features455374
Node: Reporting Bugs466589
Node: Major Differences From The Bourne Shell467861
Node: GNU Free Documentation License484708
Node: Indexes509882
Node: Builtin Index510333
Node: Reserved Word Index517157
Node: Variable Index519602
Node: Function Index536373
Node: Concept Index550154

End Tag Table
BIN
View File
Binary file not shown.
+6313 -6240
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -49,4 +49,4 @@ AAUUTTHHOORRSS
GNU Bash 5.1 2020 August 1 BASHBUG(1)
GNU Bash 5.2 2020 August 1 BASHBUG(1)
+2 -2
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.4
%%CreationDate: Fri Aug 7 11:58:10 2020
%%CreationDate: Tue Jan 11 16:04:43 2022
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -290,7 +290,7 @@ F2(EDIT)108 300 Q(OR)-.18 E F0 .327(Speci\214es the preferred editor)144
(are F)-.1 E(oundation)-.15 E(bfox@gnu.or)108 463.2 Q(g)-.18 E
(Chet Rame)108 480 Q 1.3 -.65(y, C)-.15 H(ase W).65 E(estern Reserv)-.8
E 2.5(eU)-.15 G(ni)-2.5 E -.15(ve)-.25 G(rsity).15 E(chet@po.cwru.edu)
108 492 Q(GNU Bash 5.1)72 768 Q(2020 August 1)145.395 E(1)199.555 E 0 Cg
108 492 Q(GNU Bash 5.2)72 768 Q(2020 August 1)145.395 E(1)199.555 E 0 Cg
EP
%%Trailer
end
BIN
View File
Binary file not shown.
+116 -41
View File
@@ -4,13 +4,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This text is a brief description of the features that are present in
the Bash shell (version 5.2, 26 December 2021).
the Bash shell (version 5.2, 24 February 2022).
This is Edition 5.2, last updated 26 December 2021,
This is Edition 5.2, last updated 24 February 2022,
of The GNU Bash Reference Manual,
for Bash, Version 5.2.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -77,10 +77,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<span id="Bash-Features-1"></span><h1 class="top">Bash Features</h1>
<p>This text is a brief description of the features that are present in
the Bash shell (version 5.2, 26 December 2021).
the Bash shell (version 5.2, 24 February 2022).
The Bash home page is <a href="http://www.gnu.org/software/bash/">http://www.gnu.org/software/bash/</a>.
</p>
<p>This is Edition 5.2, last updated 26 December 2021,
<p>This is Edition 5.2, last updated 24 February 2022,
of <cite>The GNU Bash Reference Manual</cite>,
for <code>Bash</code>, Version 5.2.
</p>
@@ -1947,10 +1947,22 @@ return status is the exit status of the last command executed
before the <code>return</code>.
</p>
<p>Variables local to the function may be declared with the
<code>local</code> builtin. These variables are visible only to
<code>local</code> builtin (<em>local variables</em>).
Ordinarily, variables and their values
are shared between a function and its caller.
These variables are visible only to
the function and the commands it invokes. This is particularly
important when a shell function calls other functions.
</p>
<p>In the following description, the <em>current scope</em> is a currently-
executing function.
Previous scopes consist of that function&rsquo;s caller and so on,
back to the &quot;global&quot; scope, where the shell is not executing
any shell function.
Consequently, a local variable at the current local scope is a variable
declared using the <code>local</code> or <code>declare</code> builtins in the
function that is currently executing.
</p>
<p>Local variables &quot;shadow&quot; variables with the same name declared at
previous scopes. For instance, a local variable declared in a function
hides a global variable of the same name: references and assignments
@@ -2003,11 +2015,13 @@ variable is local to the current scope, <code>unset</code> will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the current local scope is unset, it will remain so
(appearing as unset)
until it is reset in that scope or until the function returns.
Once the function returns, any instance of the variable at a previous
scope will become visible.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
variable with that name that had been shadowed will become visible
(see below how <code>localvar_unset</code>shell option changes this behavior).
</p>
<p>Function names and definitions may be listed with the
<samp>-f</samp> option to the <code>declare</code> (<code>typeset</code>)
@@ -2608,7 +2622,7 @@ var is set and not null
<dd><p>This is referred to as Substring Expansion.
It expands to up to <var>length</var> characters of the value of <var>parameter</var>
starting at the character specified by <var>offset</var>.
If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo;, an indexed array subscripted by
If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo; or &lsquo;<samp>*</samp>&rsquo;, an indexed array subscripted by
&lsquo;<samp>@</samp>&rsquo; or &lsquo;<samp>*</samp>&rsquo;, or an associative array name, the results differ as
described below.
If <var>length</var> is omitted, it expands to the substring of the value of
@@ -2683,8 +2697,8 @@ bc
$ echo ${array[0]: -7:-2}
bcdef
</pre>
<p>If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo;, the result is <var>length</var> positional
parameters beginning at <var>offset</var>.
<p>If <var>parameter</var> is &lsquo;<samp>@</samp>&rsquo; or &lsquo;<samp>*</samp>&rsquo;, the result is <var>length</var>
positional parameters beginning at <var>offset</var>.
A negative <var>offset</var> is taken relative to one greater than the greatest
positional parameter, so an offset of -1 evaluates to the last positional
parameter.
@@ -2845,45 +2859,65 @@ and the &lsquo;<samp>/</samp>&rsquo; following <var>pattern</var> may be omitted
any unquoted instances of &lsquo;<samp>&amp;</samp>&rsquo; in <var>string</var> are replaced with the
matching portion of <var>pattern</var>.
This is intended to duplicate a common <code>sed</code> idiom.
Backslash is used to quote &lsquo;<samp>&amp;</samp>&rsquo; in <var>string</var>; the backslash is removed
</p>
<p>Quoting any part of <var>string</var> inhibits replacement in the
expansion of the quoted portion, including replacement strings stored
in shell variables.
Backslash will escape &lsquo;<samp>&amp;</samp>&rsquo; in <var>string</var>; the backslash is removed
in order to permit a literal &lsquo;<samp>&amp;</samp>&rsquo; in the replacement string.
Pattern substitution performs the check for &lsquo;<samp>&amp;</samp>&rsquo; after expanding
<var>string</var>,
so users should take care to quote backslashes intended to escape
the &lsquo;<samp>&amp;</samp>&rsquo; and inhibit replacement so they survive any quote removal
performed by the expansion of <var>string</var>.
For instance,
Users should take care if <var>string</var> is double-quoted to avoid
unwanted interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes.
Pattern substitution performs the check for unquoted &lsquo;<samp>&amp;</samp>&rsquo; after
expanding <var>string</var>,
so users should ensure to properly quote any occurrences of &lsquo;<samp>&amp;</samp>&rsquo;
they want to be taken literally in the replacement
and ensure any instances of &lsquo;<samp>&amp;</samp>&rsquo; they want to be replaced are unquoted.
</p>
<p>For instance,
</p>
<div class="example">
<pre class="example">var=abcdef
rep='&amp; '
echo ${var/abc/&amp; }
echo &quot;${var/abc/&amp; }&quot;
echo ${var/abc/&quot;&amp; &quot;}
echo ${var/abc/$rep}
echo &quot;${var/abc/$rep}&quot;
</pre></div>
<p>will display three lines of &quot;abc def&quot;, while
<p>will display four lines of &quot;abc def&quot;, while
</p>
<div class="example">
<pre class="example">var=abcdef
rep='&amp; '
echo ${var/abc/\&amp; }
echo &quot;${var/abc/\&amp; }&quot;
echo ${var/abc/&quot;\&amp; &quot;}
echo ${var/abc/&quot;&amp; &quot;}
echo ${var/abc/&quot;$rep&quot;}
</pre></div>
<p>will display two lines of &quot;abc def&quot; and a third line of &quot;&amp; def&quot;.
The first two are replaced because the backslash is removed by quote
removal performed during the expansion of <var>string</var>
(the expansion is performed in a
context that doesn&rsquo;t take any enclosing double quotes into account, as
with other word expansions).
In the third case, the double quotes affect the expansion
of &lsquo;<samp>\&amp;</samp>&rsquo;, and, because &lsquo;<samp>&amp;</samp>&rsquo; is not one of the characters for
which backslash is special in double quotes,
the backslash survives the expansion, inhibits the replacement,
but is removed because it is treated specially.
One could use &lsquo;<samp>\\&amp;</samp>&rsquo;, unquoted, as the replacement string to achive
the same effect.
It should rarely be necessary to enclose only <var>string</var> in double
<p>will display four lines of &quot;&amp; def&quot;.
Like the pattern removal operators, double quotes surrounding the
replacement string quote the expanded characters, while double quotes
enclosing the entire parameter substitution do not, since
the expansion is performed in a
context that doesn&rsquo;t take any enclosing double quotes into account.
</p>
<p>Since backslash can escape &lsquo;<samp>&amp;</samp>&rsquo;, it can also escape a backslash in
the replacement string.
This means that &lsquo;<samp>\\</samp>&rsquo; will insert a literal
backslash into the replacement, so these two <code>echo</code> commands
</p>
<div class="example">
<pre class="example">var=abcdef
rep='\\&amp;xyz'
echo ${var/abc/\\&amp;xyz}
echo ${var/abc/$rep}
</pre></div>
<p>will both output &lsquo;<samp>\abcxyzdef</samp>&rsquo;.
</p>
<p>It should rarely be necessary to enclose only <var>string</var> in double
quotes.
</p>
<p>If the <code>nocasematch</code> shell option
@@ -8626,6 +8660,9 @@ interpreted as relative to one greater than the maximum index of
<var>name</var>, so negative indices count back from the end of the
array, and an index of -1 references the last element.
</p>
<p>The &lsquo;<samp>+=</samp>&rsquo; operator will append to an array variable when assigning
using the compound assignment syntax; see <a href="#Shell-Parameters">Shell Parameters</a> above.
</p>
<p>Any element of an array may be referenced using
<code>${<var>name</var>[<var>subscript</var>]}</code>.
The braces are required to avoid
@@ -9102,6 +9139,12 @@ example, <code>SIGTSTP</code>.
</li><li> Reserved words appearing in a context where reserved words are recognized
do not undergo alias expansion.
</li><li> Alias expansion is performed when initially parsing a command substitution.
The default mode generally defers it, when enabled, until the command
substitution is executed. This means that command substitution will not
expand aliases that are defined after the command substitution is initially
parsed (e.g., as part of a function definition).
</li><li> The <small>POSIX</small> <code>PS1</code> and <code>PS2</code> expansions of &lsquo;<samp>!</samp>&rsquo; to
the history number and &lsquo;<samp>!!</samp>&rsquo; to &lsquo;<samp>!</samp>&rsquo; are enabled,
and parameter expansion is performed on the values of <code>PS1</code> and
@@ -9338,8 +9381,8 @@ Previous: <a href="#Bash-POSIX-Mode" accesskey="p" rel="prev">Bash POSIX Mode</a
<span id="index-Compatibility-Level"></span>
<span id="index-Compatibility-Mode"></span>
<p>Bash-4.0 introduced the concept of a &lsquo;shell compatibility level&rsquo;, specified
as a set of options to the shopt builtin
<p>Bash-4.0 introduced the concept of a <em>shell compatibility level</em>,
specified as a set of options to the shopt builtin
(<code>compat31</code>,
<code>compat32</code>,
<code>compat40</code>,
@@ -10293,6 +10336,32 @@ variables.
</p>
<span id="index-variables_002c-readline"></span>
<dl compact="compact">
<dt id='index-active_002dregion_002dstart_002dcolor'><span><code>active-region-start-color</code><a href='#index-active_002dregion_002dstart_002dcolor' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>A string variable that controls the text color and background when displaying
the text in the active region (see the description of
<code>enable-active-region</code> below).
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal before displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that puts the terminal in standout mode,
as obtained from the terminal&rsquo;s terminfo description.
A sample value might be &lsquo;<samp>\e[01;33m</samp>&rsquo;.
</p>
</dd>
<dt id='index-active_002dregion_002dend_002dcolor'><span><code>active-region-end-color</code><a href='#index-active_002dregion_002dend_002dcolor' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>A string variable that &quot;undoes&quot; the effects of <code>active-region-start-color</code>
and restores &quot;normal&quot; terminal display appearance after displaying text
in the active region.
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal after displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that restores the terminal from standout mode,
as obtained from the terminal&rsquo;s terminfo description.
A sample value might be &lsquo;<samp>\e[0m</samp>&rsquo;.
</p>
</dd>
<dt id='index-bell_002dstyle'><span><code>bell-style</code><a href='#index-bell_002dstyle' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>Controls what happens when Readline wants to ring the terminal bell.
If set to &lsquo;<samp>none</samp>&rsquo;, Readline never rings the bell. If set to
@@ -10426,6 +10495,8 @@ The text between the point and mark is referred to as the <em>region</em>.
When this variable is set to &lsquo;<samp>On</samp>&rsquo;, Readline allows certain commands
to designate the region as <em>active</em>.
When the region is active, Readline highlights the text in the region using
the value of the <code>active-region-start-color</code>, which defaults to the
string that enables
the terminal&rsquo;s standout mode.
The active region shows the text inserted by bracketed-paste and any
matching text found by incremental and non-incremental history searches.
@@ -10433,11 +10504,13 @@ The default is &lsquo;<samp>On</samp>&rsquo;.
</p>
</dd>
<dt id='index-enable_002dbracketed_002dpaste'><span><code>enable-bracketed-paste</code><a href='#index-enable_002dbracketed_002dpaste' class='copiable-anchor'> &para;</a></span></dt>
<dd><p>When set to &lsquo;<samp>On</samp>&rsquo;, Readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
from being interpreted as editing commands. The default is &lsquo;<samp>On</samp>&rsquo;.
<dd><p>When set to &lsquo;<samp>On</samp>&rsquo;, Readline configures the terminal to insert each
paste into the editing buffer as a single string of characters, instead
of treating each character as if it had been read from the keyboard.
This is called putting the terminal into <em>bracketed paste mode</em>;
it prevents Readline from executing any editing commands bound to key
sequences appearing in the pasted text.
The default is &lsquo;<samp>On</samp>&rsquo;.
</p>
</dd>
<dt id='index-enable_002dkeypad'><span><code>enable-keypad</code><a href='#index-enable_002dkeypad' class='copiable-anchor'> &para;</a></span></dt>
@@ -15129,6 +15202,8 @@ Next: <a href="#Function-Index" accesskey="n" rel="next">Function Index</a>, Pre
<tr><td></td><td valign="top"><a href="#index-_005f"><code>_</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Bash-Variables">Bash Variables</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th id="Variable-Index_vr_letter-A">A</th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-active_002dregion_002dend_002dcolor"><code>active-region-end-color</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Readline-Init-File-Syntax">Readline Init File Syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-active_002dregion_002dstart_002dcolor"><code>active-region-start-color</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Readline-Init-File-Syntax">Readline Init File Syntax</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-auto_005fresume"><code>auto_resume</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Job-Control-Variables">Job Control Variables</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th id="Variable-Index_vr_letter-B">B</th><td></td><td></td></tr>
+325 -253
View File
@@ -2,12 +2,12 @@ This is bashref.info, produced by makeinfo version 6.8 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 26 December 2021).
Bash shell (version 5.2, 24 February 2022).
This is Edition 5.2, last updated 26 December 2021, of 'The GNU Bash
This is Edition 5.2, last updated 24 February 2022, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Copyright (C) 1988-2021 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.2, 26 December 2021). The Bash home page is
Bash shell (version 5.2, 24 February 2022). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.2, last updated 26 December 2021, of 'The GNU Bash
This is Edition 5.2, last updated 24 February 2022, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.2.
Bash contains features that appear in other popular shells, and some
@@ -1368,9 +1368,17 @@ status; otherwise the function's return status is the exit status of the
last command executed before the 'return'.
Variables local to the function may be declared with the 'local'
builtin. These variables are visible only to the function and the
commands it invokes. This is particularly important when a shell
function calls other functions.
builtin ("local variables"). Ordinarily, variables and their values are
shared between a function and its caller. These variables are visible
only to the function and the commands it invokes. This is particularly
important when a shell function calls other functions.
In the following description, the "current scope" is a currently-
executing function. Previous scopes consist of that function's caller
and so on, back to the "global" scope, where the shell is not executing
any shell function. Consequently, a local variable at the current local
scope is a variable declared using the 'local' or 'declare' builtins in
the function that is currently executing.
Local variables "shadow" variables with the same name declared at
previous scopes. For instance, a local variable declared in a function
@@ -1415,11 +1423,12 @@ script displays
variable is local to the current scope, 'unset' will unset it; otherwise
the unset will refer to the variable found in any calling scope as
described above. If a variable at the current local scope is unset, it
will remain so until it is reset in that scope or until the function
returns. Once the function returns, any instance of the variable at a
previous scope will become visible. If the unset acts on a variable at
a previous scope, any instance of a variable with that name that had
been shadowed will become visible.
will remain so (appearing as unset) until it is reset in that scope or
until the function returns. Once the function returns, any instance of
the variable at a previous scope will become visible. If the unset acts
on a variable at a previous scope, any instance of a variable with that
name that had been shadowed will become visible (see below how
'localvar_unset'shell option changes this behavior).
Function names and definitions may be listed with the '-f' option to
the 'declare' ('typeset') builtin command (*note Bash Builtins::). The
@@ -1868,11 +1877,11 @@ omitted, the operator tests only for existence.
'${PARAMETER:OFFSET:LENGTH}'
This is referred to as Substring Expansion. It expands to up to
LENGTH characters of the value of PARAMETER starting at the
character specified by OFFSET. If PARAMETER is '@', an indexed
array subscripted by '@' or '*', or an associative array name, the
results differ as described below. If LENGTH is omitted, it
expands to the substring of the value of PARAMETER starting at the
character specified by OFFSET and extending to the end of the
character specified by OFFSET. If PARAMETER is '@' or '*', an
indexed array subscripted by '@' or '*', or an associative array
name, the results differ as described below. If LENGTH is omitted,
it expands to the substring of the value of PARAMETER starting at
the character specified by OFFSET and extending to the end of the
value. LENGTH and OFFSET are arithmetic expressions (*note Shell
Arithmetic::).
@@ -1940,11 +1949,11 @@ omitted, the operator tests only for existence.
$ echo ${array[0]: -7:-2}
bcdef
If PARAMETER is '@', the result is LENGTH positional parameters
beginning at OFFSET. A negative OFFSET is taken relative to one
greater than the greatest positional parameter, so an offset of -1
evaluates to the last positional parameter. It is an expansion
error if LENGTH evaluates to a number less than zero.
If PARAMETER is '@' or '*', the result is LENGTH positional
parameters beginning at OFFSET. A negative OFFSET is taken
relative to one greater than the greatest positional parameter, so
an offset of -1 evaluates to the last positional parameter. It is
an expansion error if LENGTH evaluates to a number less than zero.
The following examples illustrate substring expansion using
positional parameters:
@@ -2079,38 +2088,58 @@ omitted, the operator tests only for existence.
If the 'patsub_replacement' shell option is enabled using 'shopt',
any unquoted instances of '&' in STRING are replaced with the
matching portion of PATTERN. This is intended to duplicate a
common 'sed' idiom. Backslash is used to quote '&' in STRING; the
backslash is removed in order to permit a literal '&' in the
replacement string. Pattern substitution performs the check for
'&' after expanding STRING, so users should take care to quote
backslashes intended to escape the '&' and inhibit replacement so
they survive any quote removal performed by the expansion of
STRING. For instance,
common 'sed' idiom.
Quoting any part of STRING inhibits replacement in the expansion of
the quoted portion, including replacement strings stored in shell
variables. Backslash will escape '&' in STRING; the backslash is
removed in order to permit a literal '&' in the replacement string.
Users should take care if STRING is double-quoted to avoid unwanted
interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes. Pattern
substitution performs the check for unquoted '&' after expanding
STRING, so users should ensure to properly quote any occurrences of
'&' they want to be taken literally in the replacement and ensure
any instances of '&' they want to be replaced are unquoted.
For instance,
var=abcdef
rep='& '
echo ${var/abc/& }
echo "${var/abc/& }"
echo ${var/abc/"& "}
echo ${var/abc/$rep}
echo "${var/abc/$rep}"
will display three lines of "abc def", while
will display four lines of "abc def", while
var=abcdef
rep='& '
echo ${var/abc/\& }
echo "${var/abc/\& }"
echo ${var/abc/"\& "}
echo ${var/abc/"& "}
echo ${var/abc/"$rep"}
will display two lines of "abc def" and a third line of "& def".
The first two are replaced because the backslash is removed by
quote removal performed during the expansion of STRING (the
expansion is performed in a context that doesn't take any enclosing
double quotes into account, as with other word expansions). In the
third case, the double quotes affect the expansion of '\&', and,
because '&' is not one of the characters for which backslash is
special in double quotes, the backslash survives the expansion,
inhibits the replacement, but is removed because it is treated
specially. One could use '\\&', unquoted, as the replacement
string to achive the same effect. It should rarely be necessary to
enclose only STRING in double quotes.
will display four lines of "& def". Like the pattern removal
operators, double quotes surrounding the replacement string quote
the expanded characters, while double quotes enclosing the entire
parameter substitution do not, since the expansion is performed in
a context that doesn't take any enclosing double quotes into
account.
Since backslash can escape '&', it can also escape a backslash in
the replacement string. This means that '\\' will insert a literal
backslash into the replacement, so these two 'echo' commands
var=abcdef
rep='\\&xyz'
echo ${var/abc/\\&xyz}
echo ${var/abc/$rep}
will both output '\abcxyzdef'.
It should rarely be necessary to enclose only STRING in double
quotes.
If the 'nocasematch' shell option (see the description of 'shopt'
in *note The Shopt Builtin::) is enabled, the match is performed
@@ -6641,6 +6670,10 @@ negative number, that number is interpreted as relative to one greater
than the maximum index of NAME, so negative indices count back from the
end of the array, and an index of -1 references the last element.
The '+=' operator will append to an array variable when assigning
using the compound assignment syntax; see *note Shell Parameters::
above.
Any element of an array may be referenced using '${NAME[SUBSCRIPT]}'.
The braces are required to avoid conflicts with the shell's filename
expansion operators. If the SUBSCRIPT is '@' or '*', the word expands
@@ -7009,73 +7042,80 @@ startup files.
7. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
8. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
8. Alias expansion is performed when initially parsing a command
substitution. The default mode generally defers it, when enabled,
until the command substitution is executed. This means that
command substitution will not expand aliases that are defined after
the command substitution is initially parsed (e.g., as part of a
function definition).
9. The POSIX 'PS1' and 'PS2' expansions of '!' to the history number
and '!!' to '!' are enabled, and parameter expansion is performed
on the values of 'PS1' and 'PS2' regardless of the setting of the
'promptvars' option.
9. The POSIX startup files are executed ('$ENV') rather than the
10. The POSIX startup files are executed ('$ENV') rather than the
normal Bash files.
10. Tilde expansion is only performed on assignments preceding a
11. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
11. The default history file is '~/.sh_history' (this is the default
12. The default history file is '~/.sh_history' (this is the default
value of '$HISTFILE').
12. Redirection operators do not perform filename expansion on the
13. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
13. Redirection operators do not perform word splitting on the word in
14. Redirection operators do not perform word splitting on the word in
the redirection.
14. Function names must be valid shell 'name's. That is, they may not
15. Function names must be valid shell 'name's. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
15. Function names may not be the same as one of the POSIX special
16. Function names may not be the same as one of the POSIX special
builtins.
16. POSIX special builtins are found before shell functions during
17. POSIX special builtins are found before shell functions during
command lookup.
17. When printing shell function definitions (e.g., by 'type'), Bash
18. When printing shell function definitions (e.g., by 'type'), Bash
does not print the 'function' keyword.
18. Literal tildes that appear as the first character in elements of
19. Literal tildes that appear as the first character in elements of
the 'PATH' variable are not expanded as described above under *note
Tilde Expansion::.
19. The 'time' reserved word may be used by itself as a command. When
20. The 'time' reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The 'TIMEFORMAT' variable controls the
format of the timing information.
20. When parsing and expanding a ${...} expansion that appears within
21. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
21. The parser does not recognize 'time' as a reserved word if the
22. The parser does not recognize 'time' as a reserved word if the
next token begins with a '-'.
22. The '!' character does not introduce history expansion within a
23. The '!' character does not introduce history expansion within a
double-quoted string, even if the 'histexpand' option is enabled.
23. If a POSIX special builtin returns an error status, a
24. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
24. A non-interactive shell exits with an error status if a variable
25. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
25. A non-interactive shell exits with an error status if a variable
26. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command. For any
other simple command, the shell aborts execution of that command,
@@ -7083,133 +7123,133 @@ startup files.
perform any further processing of the command in which the error
occurred").
26. A non-interactive shell exits with an error status if the
27. A non-interactive shell exits with an error status if the
iteration variable in a 'for' statement or the selection variable
in a 'select' statement is a readonly variable.
27. Non-interactive shells exit if FILENAME in '.' FILENAME is not
28. Non-interactive shells exit if FILENAME in '.' FILENAME is not
found.
28. Non-interactive shells exit if a syntax error in an arithmetic
29. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
29. Non-interactive shells exit if a parameter expansion error occurs.
30. Non-interactive shells exit if a parameter expansion error occurs.
30. Non-interactive shells exit if there is a syntax error in a script
31. Non-interactive shells exit if there is a syntax error in a script
read with the '.' or 'source' builtins, or in a string processed by
the 'eval' builtin.
31. While variable indirection is available, it may not be applied to
32. While variable indirection is available, it may not be applied to
the '#' and '?' special parameters.
32. When expanding the '*' special parameter in a pattern context
33. When expanding the '*' special parameter in a pattern context
where the expansion is double-quoted does not treat the '$*' as if
it were double-quoted.
33. Assignment statements preceding POSIX special builtins persist in
34. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
34. The 'command' builtin does not prevent builtins that take
35. The 'command' builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by 'command'.
35. The 'bg' builtin uses the required format to describe each job
36. The 'bg' builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
36. The output of 'kill -l' prints all the signal names on a single
37. The output of 'kill -l' prints all the signal names on a single
line, separated by spaces, without the 'SIG' prefix.
37. The 'kill' builtin does not accept signal names with a 'SIG'
38. The 'kill' builtin does not accept signal names with a 'SIG'
prefix.
38. The 'export' and 'readonly' builtin commands display their output
39. The 'export' and 'readonly' builtin commands display their output
in the format required by POSIX.
39. The 'trap' builtin displays signal names without the leading
40. The 'trap' builtin displays signal names without the leading
'SIG'.
40. The 'trap' builtin doesn't check the first argument for a possible
41. The 'trap' builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use '-' as the first argument.
41. 'trap -p' displays signals whose dispositions are set to SIG_DFL
42. 'trap -p' displays signals whose dispositions are set to SIG_DFL
and those that were ignored when the shell started.
42. The '.' and 'source' builtins do not search the current directory
43. The '.' and 'source' builtins do not search the current directory
for the filename argument if it is not found by searching 'PATH'.
43. Enabling POSIX mode has the effect of setting the
44. Enabling POSIX mode has the effect of setting the
'inherit_errexit' option, so subshells spawned to execute command
substitutions inherit the value of the '-e' option from the parent
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
44. Enabling POSIX mode has the effect of setting the 'shift_verbose'
45. Enabling POSIX mode has the effect of setting the 'shift_verbose'
option, so numeric arguments to 'shift' that exceed the number of
positional parameters will result in an error message.
45. When the 'alias' builtin displays alias definitions, it does not
46. When the 'alias' builtin displays alias definitions, it does not
display them with a leading 'alias ' unless the '-p' option is
supplied.
46. When the 'set' builtin is invoked without options, it does not
47. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
47. When the 'set' builtin is invoked without options, it displays
48. When the 'set' builtin is invoked without options, it displays
variable values without quotes, unless they contain shell
metacharacters, even if the result contains nonprinting characters.
48. When the 'cd' builtin is invoked in logical mode, and the pathname
49. When the 'cd' builtin is invoked in logical mode, and the pathname
constructed from '$PWD' and the directory name supplied as an
argument does not refer to an existing directory, 'cd' will fail
instead of falling back to physical mode.
49. When the 'cd' builtin cannot change a directory because the length
50. When the 'cd' builtin cannot change a directory because the length
of the pathname constructed from '$PWD' and the directory name
supplied as an argument exceeds 'PATH_MAX' when all symbolic links
are expanded, 'cd' will fail instead of attempting to use only the
supplied directory name.
50. The 'pwd' builtin verifies that the value it prints is the same as
51. The 'pwd' builtin verifies that the value it prints is the same as
the current directory, even if it is not asked to check the file
system with the '-P' option.
51. When listing the history, the 'fc' builtin does not include an
52. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
52. The default editor used by 'fc' is 'ed'.
53. The default editor used by 'fc' is 'ed'.
53. The 'type' and 'command' builtins will not report a non-executable
54. The 'type' and 'command' builtins will not report a non-executable
file as having been found, though the shell will attempt to execute
such a file if it is the only so-named file found in '$PATH'.
54. The 'vi' editing mode will invoke the 'vi' editor directly when
55. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
55. When the 'xpg_echo' option is enabled, Bash does not attempt to
56. When the 'xpg_echo' option is enabled, Bash does not attempt to
interpret any arguments to 'echo' as options. Each argument is
displayed, after escape characters are converted.
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
57. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
57. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
58. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
interrupt the 'wait' builtin and cause it to return immediately.
The trap command is run once for each child that exits.
58. The 'read' builtin may be interrupted by a signal for which a trap
59. The 'read' builtin may be interrupted by a signal for which a trap
has been set. If Bash receives a trapped signal while executing
'read', the trap handler executes and 'read' returns an exit status
greater than 128.
59. Bash removes an exited background process's status from the list
60. Bash removes an exited background process's status from the list
of such statuses after the 'wait' builtin is used to obtain it.
There is other POSIX behavior that Bash does not implement by default
@@ -7232,7 +7272,7 @@ File: bashref.info, Node: Shell Compatibility Mode, Prev: Bash POSIX Mode, Up
6.12 Shell Compatibility Mode
=============================
Bash-4.0 introduced the concept of a 'shell compatibility level',
Bash-4.0 introduced the concept of a "shell compatibility level",
specified as a set of options to the shopt builtin ('compat31',
'compat32', 'compat40', 'compat41', and so on). There is only one
current compatibility level - each option is mutually exclusive. The
@@ -7982,6 +8022,32 @@ Variable Settings
A great deal of run-time behavior is changeable with the following
variables.
'active-region-start-color'
A string variable that controls the text color and background
when displaying the text in the active region (see the
description of 'enable-active-region' below). This string
must not take up any physical character positions on the
display, so it should consist only of terminal escape
sequences. It is output to the terminal before displaying the
text in the active region. This variable is reset to the
default value whenever the terminal type changes. The default
value is the string that puts the terminal in standout mode,
as obtained from the terminal's terminfo description. A
sample value might be '\e[01;33m'.
'active-region-end-color'
A string variable that "undoes" the effects of
'active-region-start-color' and restores "normal" terminal
display appearance after displaying text in the active region.
This string must not take up any physical character positions
on the display, so it should consist only of terminal escape
sequences. It is output to the terminal after displaying the
text in the active region. This variable is reset to the
default value whenever the terminal type changes. The default
value is the string that restores the terminal from standout
mode, as obtained from the terminal's terminfo description. A
sample value might be '\e[0m'.
'bell-style'
Controls what happens when Readline wants to ring the terminal
bell. If set to 'none', Readline never rings the bell. If
@@ -8097,18 +8163,20 @@ Variable Settings
"region". When this variable is set to 'On', Readline allows
certain commands to designate the region as "active". When
the region is active, Readline highlights the text in the
region using the terminal's standout mode. The active region
shows the text inserted by bracketed-paste and any matching
text found by incremental and non-incremental history
searches. The default is 'On'.
region using the value of the 'active-region-start-color',
which defaults to the string that enables the terminal's
standout mode. The active region shows the text inserted by
bracketed-paste and any matching text found by incremental and
non-incremental history searches. The default is 'On'.
'enable-bracketed-paste'
When set to 'On', Readline will configure the terminal in a
way that will enable it to insert each paste into the editing
buffer as a single string of characters, instead of treating
each character as if it had been read from the keyboard. This
can prevent pasted characters from being interpreted as
editing commands. The default is 'On'.
When set to 'On', Readline configures the terminal to insert
each paste into the editing buffer as a single string of
characters, instead of treating each character as if it had
been read from the keyboard. This is called putting the
terminal into "bracketed paste mode"; it prevents Readline
from executing any editing commands bound to key sequences
appearing in the pasted text. The default is 'On'.
'enable-keypad'
When set to 'on', Readline will try to enable the application
@@ -11836,6 +11904,10 @@ D.3 Parameter and Variable Index
* ?: Special Parameters. (line 42)
* @: Special Parameters. (line 22)
* _: Bash Variables. (line 13)
* active-region-end-color: Readline Init File Syntax.
(line 51)
* active-region-start-color: Readline Init File Syntax.
(line 38)
* auto_resume: Job Control Variables.
(line 6)
* BASH: Bash Variables. (line 23)
@@ -11859,31 +11931,31 @@ D.3 Parameter and Variable Index
* BASH_VERSION: Bash Variables. (line 181)
* BASH_XTRACEFD: Bash Variables. (line 184)
* bell-style: Readline Init File Syntax.
(line 38)
(line 64)
* bind-tty-special-chars: Readline Init File Syntax.
(line 45)
(line 71)
* blink-matching-paren: Readline Init File Syntax.
(line 50)
(line 76)
* CDPATH: Bourne Shell Variables.
(line 9)
* CHILD_MAX: Bash Variables. (line 195)
* colored-completion-prefix: Readline Init File Syntax.
(line 55)
(line 81)
* colored-stats: Readline Init File Syntax.
(line 65)
(line 91)
* COLUMNS: Bash Variables. (line 202)
* comment-begin: Readline Init File Syntax.
(line 71)
(line 97)
* completion-display-width: Readline Init File Syntax.
(line 76)
(line 102)
* completion-ignore-case: Readline Init File Syntax.
(line 83)
(line 109)
* completion-map-case: Readline Init File Syntax.
(line 88)
(line 114)
* completion-prefix-display-length: Readline Init File Syntax.
(line 94)
(line 120)
* completion-query-items: Readline Init File Syntax.
(line 101)
(line 127)
* COMPREPLY: Bash Variables. (line 254)
* COMP_CWORD: Bash Variables. (line 208)
* COMP_KEY: Bash Variables. (line 237)
@@ -11893,31 +11965,31 @@ D.3 Parameter and Variable Index
* COMP_WORDBREAKS: Bash Variables. (line 241)
* COMP_WORDS: Bash Variables. (line 247)
* convert-meta: Readline Init File Syntax.
(line 112)
(line 138)
* COPROC: Bash Variables. (line 260)
* DIRSTACK: Bash Variables. (line 264)
* disable-completion: Readline Init File Syntax.
(line 120)
(line 146)
* echo-control-characters: Readline Init File Syntax.
(line 125)
(line 151)
* editing-mode: Readline Init File Syntax.
(line 130)
(line 156)
* EMACS: Bash Variables. (line 274)
* emacs-mode-string: Readline Init File Syntax.
(line 136)
(line 162)
* enable-active-region: Readline Init File Syntax.
(line 146)
(line 172)
* enable-bracketed-paste: Readline Init File Syntax.
(line 158)
(line 185)
* enable-keypad: Readline Init File Syntax.
(line 166)
(line 194)
* ENV: Bash Variables. (line 279)
* EPOCHREALTIME: Bash Variables. (line 284)
* EPOCHSECONDS: Bash Variables. (line 292)
* EUID: Bash Variables. (line 299)
* EXECIGNORE: Bash Variables. (line 303)
* expand-tilde: Readline Init File Syntax.
(line 177)
(line 205)
* FCEDIT: Bash Variables. (line 316)
* FIGNORE: Bash Variables. (line 320)
* FUNCNAME: Bash Variables. (line 326)
@@ -11931,15 +12003,15 @@ D.3 Parameter and Variable Index
* HISTFILESIZE: Bash Variables. (line 402)
* HISTIGNORE: Bash Variables. (line 413)
* history-preserve-point: Readline Init File Syntax.
(line 181)
(line 209)
* history-size: Readline Init File Syntax.
(line 187)
(line 215)
* HISTSIZE: Bash Variables. (line 433)
* HISTTIMEFORMAT: Bash Variables. (line 440)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 196)
(line 224)
* HOSTFILE: Bash Variables. (line 448)
* HOSTNAME: Bash Variables. (line 459)
* HOSTTYPE: Bash Variables. (line 462)
@@ -11947,13 +12019,13 @@ D.3 Parameter and Variable Index
(line 18)
* IGNOREEOF: Bash Variables. (line 465)
* input-meta: Readline Init File Syntax.
(line 205)
(line 233)
* INPUTRC: Bash Variables. (line 475)
* INSIDE_EMACS: Bash Variables. (line 479)
* isearch-terminators: Readline Init File Syntax.
(line 213)
(line 241)
* keymap: Readline Init File Syntax.
(line 220)
(line 248)
* LANG: Creating Internationalized Scripts.
(line 51)
* LANG <1>: Bash Variables. (line 485)
@@ -11975,15 +12047,15 @@ D.3 Parameter and Variable Index
(line 27)
* MAPFILE: Bash Variables. (line 540)
* mark-modified-lines: Readline Init File Syntax.
(line 250)
(line 278)
* mark-symlinked-directories: Readline Init File Syntax.
(line 255)
(line 283)
* match-hidden-files: Readline Init File Syntax.
(line 260)
(line 288)
* menu-complete-display-prefix: Readline Init File Syntax.
(line 267)
(line 295)
* meta-flag: Readline Init File Syntax.
(line 205)
(line 233)
* OLDPWD: Bash Variables. (line 544)
* OPTARG: Bourne Shell Variables.
(line 34)
@@ -11992,9 +12064,9 @@ D.3 Parameter and Variable Index
(line 38)
* OSTYPE: Bash Variables. (line 551)
* output-meta: Readline Init File Syntax.
(line 272)
(line 300)
* page-completions: Readline Init File Syntax.
(line 278)
(line 306)
* PATH: Bourne Shell Variables.
(line 42)
* PIPESTATUS: Bash Variables. (line 554)
@@ -12017,19 +12089,19 @@ D.3 Parameter and Variable Index
* READLINE_POINT: Bash Variables. (line 626)
* REPLY: Bash Variables. (line 630)
* revert-all-at-newline: Readline Init File Syntax.
(line 288)
(line 316)
* SECONDS: Bash Variables. (line 633)
* SHELL: Bash Variables. (line 642)
* SHELLOPTS: Bash Variables. (line 647)
* SHLVL: Bash Variables. (line 656)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 294)
(line 322)
* show-all-if-unmodified: Readline Init File Syntax.
(line 300)
(line 328)
* show-mode-in-prompt: Readline Init File Syntax.
(line 309)
(line 337)
* skip-completed-text: Readline Init File Syntax.
(line 315)
(line 343)
* SRANDOM: Bash Variables. (line 661)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
@@ -12040,11 +12112,11 @@ D.3 Parameter and Variable Index
* TMPDIR: Bash Variables. (line 720)
* UID: Bash Variables. (line 724)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 328)
(line 356)
* vi-ins-mode-string: Readline Init File Syntax.
(line 339)
(line 367)
* visible-stats: Readline Init File Syntax.
(line 350)
(line 378)

File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Indexes
@@ -12451,110 +12523,110 @@ Node: Command Grouping48898
Node: Coprocesses50376
Node: GNU Parallel53039
Node: Shell Functions53956
Node: Shell Parameters61247
Node: Positional Parameters65635
Node: Special Parameters66537
Node: Shell Expansions69751
Node: Brace Expansion71878
Node: Tilde Expansion74612
Node: Shell Parameter Expansion77233
Node: Command Substitution95099
Node: Arithmetic Expansion96454
Node: Process Substitution97422
Node: Word Splitting98542
Node: Filename Expansion100486
Node: Pattern Matching103235
Node: Quote Removal107843
Node: Redirections108138
Node: Executing Commands117798
Node: Simple Command Expansion118468
Node: Command Search and Execution120578
Node: Command Execution Environment122956
Node: Environment125991
Node: Exit Status127654
Node: Signals129438
Node: Shell Scripts132887
Node: Shell Builtin Commands135914
Node: Bourne Shell Builtins137952
Node: Bash Builtins159413
Node: Modifying Shell Behavior190269
Node: The Set Builtin190614
Node: The Shopt Builtin201215
Node: Special Builtins217127
Node: Shell Variables218106
Node: Bourne Shell Variables218543
Node: Bash Variables220647
Node: Bash Features253463
Node: Invoking Bash254476
Node: Bash Startup Files260489
Node: Interactive Shells265592
Node: What is an Interactive Shell?266002
Node: Is this Shell Interactive?266651
Node: Interactive Shell Behavior267466
Node: Bash Conditional Expressions271095
Node: Shell Arithmetic275737
Node: Aliases278681
Node: Arrays281294
Node: The Directory Stack287541
Node: Directory Stack Builtins288325
Node: Controlling the Prompt292585
Node: The Restricted Shell295550
Node: Bash POSIX Mode298160
Node: Shell Compatibility Mode309433
Node: Job Control317462
Node: Job Control Basics317922
Node: Job Control Builtins322924
Node: Job Control Variables328324
Node: Command Line Editing329480
Node: Introduction and Notation331151
Node: Readline Interaction332774
Node: Readline Bare Essentials333965
Node: Readline Movement Commands335748
Node: Readline Killing Commands336708
Node: Readline Arguments338626
Node: Searching339670
Node: Readline Init File341856
Node: Readline Init File Syntax343117
Node: Conditional Init Constructs364605
Node: Sample Init File368801
Node: Bindable Readline Commands371925
Node: Commands For Moving373129
Node: Commands For History375180
Node: Commands For Text380174
Node: Commands For Killing383823
Node: Numeric Arguments386856
Node: Commands For Completion387995
Node: Keyboard Macros392186
Node: Miscellaneous Commands392873
Node: Readline vi Mode398812
Node: Programmable Completion399719
Node: Programmable Completion Builtins407499
Node: A Programmable Completion Example418194
Node: Using History Interactively423441
Node: Bash History Facilities424125
Node: Bash History Builtins427130
Node: History Interaction432138
Node: Event Designators435758
Node: Word Designators437112
Node: Modifiers438872
Node: Installing Bash440683
Node: Basic Installation441820
Node: Compilers and Options445542
Node: Compiling For Multiple Architectures446283
Node: Installation Names447976
Node: Specifying the System Type450085
Node: Sharing Defaults450801
Node: Operation Controls451474
Node: Optional Features452432
Node: Reporting Bugs463650
Node: Major Differences From The Bourne Shell464925
Node: GNU Free Documentation License481775
Node: Indexes506952
Node: Builtin Index507406
Node: Reserved Word Index514233
Node: Variable Index516681
Node: Function Index533173
Node: Concept Index546957
Node: Shell Parameters61841
Node: Positional Parameters66229
Node: Special Parameters67131
Node: Shell Expansions70345
Node: Brace Expansion72472
Node: Tilde Expansion75206
Node: Shell Parameter Expansion77827
Node: Command Substitution96178
Node: Arithmetic Expansion97533
Node: Process Substitution98501
Node: Word Splitting99621
Node: Filename Expansion101565
Node: Pattern Matching104314
Node: Quote Removal108922
Node: Redirections109217
Node: Executing Commands118877
Node: Simple Command Expansion119547
Node: Command Search and Execution121657
Node: Command Execution Environment124035
Node: Environment127070
Node: Exit Status128733
Node: Signals130517
Node: Shell Scripts133966
Node: Shell Builtin Commands136993
Node: Bourne Shell Builtins139031
Node: Bash Builtins160492
Node: Modifying Shell Behavior191348
Node: The Set Builtin191693
Node: The Shopt Builtin202294
Node: Special Builtins218206
Node: Shell Variables219185
Node: Bourne Shell Variables219622
Node: Bash Variables221726
Node: Bash Features254542
Node: Invoking Bash255555
Node: Bash Startup Files261568
Node: Interactive Shells266671
Node: What is an Interactive Shell?267081
Node: Is this Shell Interactive?267730
Node: Interactive Shell Behavior268545
Node: Bash Conditional Expressions272174
Node: Shell Arithmetic276816
Node: Aliases279760
Node: Arrays282373
Node: The Directory Stack288764
Node: Directory Stack Builtins289548
Node: Controlling the Prompt293808
Node: The Restricted Shell296773
Node: Bash POSIX Mode299383
Node: Shell Compatibility Mode311033
Node: Job Control319062
Node: Job Control Basics319522
Node: Job Control Builtins324524
Node: Job Control Variables329924
Node: Command Line Editing331080
Node: Introduction and Notation332751
Node: Readline Interaction334374
Node: Readline Bare Essentials335565
Node: Readline Movement Commands337348
Node: Readline Killing Commands338308
Node: Readline Arguments340226
Node: Searching341270
Node: Readline Init File343456
Node: Readline Init File Syntax344717
Node: Conditional Init Constructs367916
Node: Sample Init File372112
Node: Bindable Readline Commands375236
Node: Commands For Moving376440
Node: Commands For History378491
Node: Commands For Text383485
Node: Commands For Killing387134
Node: Numeric Arguments390167
Node: Commands For Completion391306
Node: Keyboard Macros395497
Node: Miscellaneous Commands396184
Node: Readline vi Mode402123
Node: Programmable Completion403030
Node: Programmable Completion Builtins410810
Node: A Programmable Completion Example421505
Node: Using History Interactively426752
Node: Bash History Facilities427436
Node: Bash History Builtins430441
Node: History Interaction435449
Node: Event Designators439069
Node: Word Designators440423
Node: Modifiers442183
Node: Installing Bash443994
Node: Basic Installation445131
Node: Compilers and Options448853
Node: Compiling For Multiple Architectures449594
Node: Installation Names451287
Node: Specifying the System Type453396
Node: Sharing Defaults454112
Node: Operation Controls454785
Node: Optional Features455743
Node: Reporting Bugs466961
Node: Major Differences From The Bourne Shell468236
Node: GNU Free Documentation License485086
Node: Indexes510263
Node: Builtin Index510717
Node: Reserved Word Index517544
Node: Variable Index519992
Node: Function Index536766
Node: Concept Index550550

End Tag Table
BIN
View File
Binary file not shown.
+4208 -4124
View File
File diff suppressed because it is too large Load Diff
+75 -30
View File
@@ -14,7 +14,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED},
of @cite{The GNU Bash Reference Manual},
for @code{Bash}, Version @value{VERSION}.
Copyright @copyright{} 1988--2021 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2022 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -1600,10 +1600,22 @@ return status is the exit status of the last command executed
before the @code{return}.
Variables local to the function may be declared with the
@code{local} builtin. These variables are visible only to
@code{local} builtin (@dfn{local variables}).
Ordinarily, variables and their values
are shared between a function and its caller.
These variables are visible only to
the function and the commands it invokes. This is particularly
important when a shell function calls other functions.
In the following description, the @dfn{current scope} is a currently-
executing function.
Previous scopes consist of that function's caller and so on,
back to the "global" scope, where the shell is not executing
any shell function.
Consequently, a local variable at the current local scope is a variable
declared using the @code{local} or @code{declare} builtins in the
function that is currently executing.
Local variables "shadow" variables with the same name declared at
previous scopes. For instance, a local variable declared in a function
hides a global variable of the same name: references and assignments
@@ -1656,11 +1668,13 @@ variable is local to the current scope, @code{unset} will unset it;
otherwise the unset will refer to the variable found in any calling scope
as described above.
If a variable at the current local scope is unset, it will remain so
(appearing as unset)
until it is reset in that scope or until the function returns.
Once the function returns, any instance of the variable at a previous
scope will become visible.
If the unset acts on a variable at a previous scope, any instance of a
variable with that name that had been shadowed will become visible.
variable with that name that had been shadowed will become visible
(see below how @code{localvar_unset}shell option changes this behavior).
Function names and definitions may be listed with the
@option{-f} option to the @code{declare} (@code{typeset})
@@ -2207,7 +2221,7 @@ var is set and not null
This is referred to as Substring Expansion.
It expands to up to @var{length} characters of the value of @var{parameter}
starting at the character specified by @var{offset}.
If @var{parameter} is @samp{@@}, an indexed array subscripted by
If @var{parameter} is @samp{@@} or @samp{*}, an indexed array subscripted by
@samp{@@} or @samp{*}, or an associative array name, the results differ as
described below.
If @var{length} is omitted, it expands to the substring of the value of
@@ -2284,8 +2298,8 @@ $ echo ${array[0]: -7:-2}
bcdef
@end verbatim
If @var{parameter} is @samp{@@}, the result is @var{length} positional
parameters beginning at @var{offset}.
If @var{parameter} is @samp{@@} or @samp{*}, the result is @var{length}
positional parameters beginning at @var{offset}.
A negative @var{offset} is taken relative to one greater than the greatest
positional parameter, so an offset of -1 evaluates to the last positional
parameter.
@@ -2444,46 +2458,67 @@ If the @code{patsub_replacement} shell option is enabled using @code{shopt},
any unquoted instances of @samp{&} in @var{string} are replaced with the
matching portion of @var{pattern}.
This is intended to duplicate a common @code{sed} idiom.
Backslash is used to quote @samp{&} in @var{string}; the backslash is removed
Quoting any part of @var{string} inhibits replacement in the
expansion of the quoted portion, including replacement strings stored
in shell variables.
Backslash will escape @samp{&} in @var{string}; the backslash is removed
in order to permit a literal @samp{&} in the replacement string.
Pattern substitution performs the check for @samp{&} after expanding
@var{string},
so users should take care to quote backslashes intended to escape
the @samp{&} and inhibit replacement so they survive any quote removal
performed by the expansion of @var{string}.
Users should take care if @var{string} is double-quoted to avoid
unwanted interactions between the backslash and double-quoting, since
backslash has special meaning within double quotes.
Pattern substitution performs the check for unquoted @samp{&} after
expanding @var{string},
so users should ensure to properly quote any occurrences of @samp{&}
they want to be taken literally in the replacement
and ensure any instances of @samp{&} they want to be replaced are unquoted.
For instance,
@example
var=abcdef
rep='& '
echo $@{var/abc/& @}
echo "$@{var/abc/& @}"
echo $@{var/abc/"& "@}
echo $@{var/abc/$rep@}
echo "$@{var/abc/$rep@}"
@end example
@noindent
will display three lines of "abc def", while
will display four lines of "abc def", while
@example
var=abcdef
rep='& '
echo $@{var/abc/\& @}
echo "$@{var/abc/\& @}"
echo $@{var/abc/"\& "@}
echo $@{var/abc/"& "@}
echo $@{var/abc/"$rep"@}
@end example
@noindent
will display two lines of "abc def" and a third line of "& def".
The first two are replaced because the backslash is removed by quote
removal performed during the expansion of @var{string}
(the expansion is performed in a
context that doesn't take any enclosing double quotes into account, as
with other word expansions).
In the third case, the double quotes affect the expansion
of @samp{\&}, and, because @samp{&} is not one of the characters for
which backslash is special in double quotes,
the backslash survives the expansion, inhibits the replacement,
but is removed because it is treated specially.
One could use @samp{\\&}, unquoted, as the replacement string to achive
the same effect.
will display four lines of "& def".
Like the pattern removal operators, double quotes surrounding the
replacement string quote the expanded characters, while double quotes
enclosing the entire parameter substitution do not, since
the expansion is performed in a
context that doesn't take any enclosing double quotes into account.
Since backslash can escape @samp{&}, it can also escape a backslash in
the replacement string.
This means that @samp{\\} will insert a literal
backslash into the replacement, so these two @code{echo} commands
@example
var=abcdef
rep='\\&xyz'
echo $@{var/abc/\\&xyz@}
echo $@{var/abc/$rep@}
@end example
@noindent
will both output @samp{\abcxyzdef}.
It should rarely be necessary to enclose only @var{string} in double
quotes.
@@ -7666,6 +7701,9 @@ interpreted as relative to one greater than the maximum index of
@var{name}, so negative indices count back from the end of the
array, and an index of -1 references the last element.
The @samp{+=} operator will append to an array variable when assigning
using the compound assignment syntax; see @ref{Shell Parameters} above.
Any element of an array may be referenced using
@code{$@{@var{name}[@var{subscript}]@}}.
The braces are required to avoid
@@ -8094,6 +8132,13 @@ Alias expansion is always enabled, even in non-interactive shells.
Reserved words appearing in a context where reserved words are recognized
do not undergo alias expansion.
@item
Alias expansion is performed when initially parsing a command substitution.
The default mode generally defers it, when enabled, until the command
substitution is executed. This means that command substitution will not
expand aliases that are defined after the command substitution is initially
parsed (e.g., as part of a function definition).
@item
The @sc{posix} @env{PS1} and @env{PS2} expansions of @samp{!} to
the history number and @samp{!!} to @samp{!} are enabled,
@@ -8385,8 +8430,8 @@ the @option{--enable-strict-posix-default} to @code{configure} when building
@cindex Compatibility Level
@cindex Compatibility Mode
Bash-4.0 introduced the concept of a `shell compatibility level', specified
as a set of options to the shopt builtin
Bash-4.0 introduced the concept of a @dfn{shell compatibility level},
specified as a set of options to the shopt builtin
(@code{compat31},
@code{compat32},
@code{compat40},
+8 -8
View File
@@ -1939,14 +1939,14 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
exit status of the last process or job waited for.
SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE
Bash-4.0 introduced the concept of a `shell compatibility level', spec-
ified as a set of options to the shopt builtin ccoommppaatt3311, ccoommppaatt3322, ccoomm--
ppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibility
level -- each option is mutually exclusive. The compatibility level is
intended to allow users to select behavior from previous versions that
is incompatible with newer versions while they migrate scripts to use
current features and behavior. It's intended to be a temporary solu-
tion.
Bash-4.0 introduced the concept of a _s_h_e_l_l _c_o_m_p_a_t_i_b_i_l_i_t_y _l_e_v_e_l, speci-
fied as a set of options to the shopt builtin ( ccoommppaatt3311, ccoommppaatt3322,
ccoommppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibil-
ity level -- each option is mutually exclusive. The compatibility
level is intended to allow users to select behavior from previous ver-
sions that is incompatible with newer versions while they migrate
scripts to use current features and behavior. It's intended to be a
temporary solution.
This section does not mention behavior that is standard for a particu-
lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the
+11 -12
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.4
%%CreationDate: Tue Jan 11 15:02:05 2022
%%CreationDate: Fri Apr 8 15:46:03 2022
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
@@ -3221,17 +3221,16 @@ E F2(id)3.083 E F0 3.083(sa)C .583(re supplied, an)-3.083 F 3.083(yj)
(Otherwise, the return status is the e)5 E
(xit status of the last process or job w)-.15 E(aited for)-.1 E(.)-.55 E
/F5 10.95/Times-Bold@0 SF(SHELL COMP)72 576 Q -1.04(AT)-.81 G
(IBILITY MODE)1.04 E F0 .912
(Bash-4.0 introduced the concept of a `shell compatibility le)108 588 R
-.15(ve)-.25 G .912(l', speci\214ed as a set of options to the shopt).15
F -.2(bu)108 600 S(iltin).2 E F1(compat31)3.377 E F0(,)A F1(compat32)
3.377 E F0(,)A F1(compat40)3.377 E F0(,)A F1(compat41)3.377 E F0 3.378
(,a)C .878(nd so on\).)-3.378 F .878
(There is only one current compatibility)5.878 F(le)108 612 Q -.15(ve)
-.25 G 3.254(l-).15 G 3.254(-e)-3.254 G .754(ach option is mutually e)
-3.254 F(xclusi)-.15 E -.15(ve)-.25 G 5.754(.T).15 G .754
(he compatibility le)-5.754 F -.15(ve)-.25 G 3.253(li).15 G 3.253(si)
-3.253 G .753(ntended to allo)-3.253 F 3.253(wu)-.25 G .753
(IBILITY MODE)1.04 E F0 1.355(Bash-4.0 introduced the concept of a)108
588 R F2 1.355(shell compatibility le)3.855 F(vel)-.15 E F0 3.855(,s)C
1.354(peci\214ed as a set of options to the shopt)-3.855 F -.2(bu)108
600 S .398(iltin \().2 F F1(compat31)2.898 E F0(,)A F1(compat32)2.898 E
F0(,)A F1(compat40)2.898 E F0(,)A F1(compat41)2.898 E F0 2.898(,a)C .399
(nd so on\).)-2.898 F .399(There is only one current compatibility)5.399
F(le)108 612 Q -.15(ve)-.25 G 3.254(l-).15 G 3.254(-e)-3.254 G .754
(ach option is mutually e)-3.254 F(xclusi)-.15 E -.15(ve)-.25 G 5.754
(.T).15 G .754(he compatibility le)-5.754 F -.15(ve)-.25 G 3.253(li).15
G 3.253(si)-3.253 G .753(ntended to allo)-3.253 F 3.253(wu)-.25 G .753
(sers to select be-)-3.253 F(ha)108 624 Q 1.083(vior from pre)-.2 F
1.083(vious v)-.25 F 1.083(ersions that is incompatible with ne)-.15 F
1.083(wer v)-.25 F 1.083(ersions while the)-.15 F 3.584(ym)-.15 G 1.084
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.4
%%CreationDate: Tue Jan 11 15:02:05 2022
%%CreationDate: Fri Apr 8 15:46:03 2022
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 4
+4 -4
View File
@@ -1,11 +1,11 @@
@ignore
Copyright (C) 1988-2021 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sun Dec 26 16:02:48 EST 2021
@set LASTCHANGE Thu Feb 24 14:43:35 EST 2022
@set EDITION 5.2
@set VERSION 5.2
@set UPDATED 26 December 2021
@set UPDATED-MONTH December 2021
@set UPDATED 24 February 2022
@set UPDATED-MONTH February 2022
+7 -7
View File
@@ -39,9 +39,9 @@
element of array variable CSV, starting at index 0. The format of LINE is
as described in RFC 4180. */
static int
csvsplit (csv, line)
csvsplit (csv, line, dstring)
SHELL_VAR *csv;
char *line;
char *line, *dstring;
{
arrayind_t ind;
char *field, *prev, *buf, *xbuf;
@@ -67,7 +67,7 @@ csvsplit (csv, line)
buf[b++] = *field++; /* skip double quote */
else if (qstate == DQUOTE && *field == '"')
qstate = NQUOTE;
else if (qstate == NQUOTE && *field == ',')
else if (qstate == NQUOTE && *field == *dstring)
break;
else
/* This copies any text between a closing double quote and the
@@ -80,7 +80,7 @@ csvsplit (csv, line)
else
{
buf = prev;
field = prev + strcspn (prev, ",");
field = prev + strcspn (prev, dstring);
}
delim = *field;
@@ -91,10 +91,10 @@ csvsplit (csv, line)
*field = delim;
if (delim == ',')
if (delim == *dstring)
prev = field + 1;
}
while (delim == ',');
while (delim == *dstring);
if (xbuf)
free (xbuf);
@@ -165,7 +165,7 @@ csv_builtin (list)
if (csvstring == 0 || *csvstring == 0)
return (EXECUTION_SUCCESS);
opt = csvsplit (v, csvstring);
opt = csvsplit (v, csvstring, ",");
/* Maybe do something with OPT here, it's the number of fields */
return (rval);
+12 -5
View File
@@ -3,23 +3,24 @@
*/
#include <config.h>
#include <fcntl.h>
#include <errno.h>
#include "builtins.h"
#include "shell.h"
#include "common.h"
#ifndef errno
extern int errno;
#endif
extern char **make_builtin_argv ();
extern char **make_builtin_argv (WORD_LIST *, int *);
extern char **export_env;
extern int perl_main();
extern void perl_close(void);
extern int perl_main(int, char **, char **);
bperl_builtin(list)
WORD_LIST *list;
int
bperl_builtin(WORD_LIST *list)
{
char **v;
int c, r;
@@ -31,6 +32,12 @@ WORD_LIST *list;
return r;
}
void
bperl_builtin_unload (char *s)
{
perl_close();
}
char *bperl_doc[] = {
"An interface to a perl5 interpreter.",
(char *)0
+15 -1
View File
@@ -1,15 +1,29 @@
#include <EXTERN.h> /* from the Perl distribution */
#include <perl.h> /* from the Perl distribution */
extern void xs_init _((void));
#define iperl my_perl /* I guess the name `my_perl' is required */
extern void xs_init (pTHX);
static PerlInterpreter *iperl; /*** The Perl interpreter ***/
static int first = 1;
void
perl_close (void)
{
PERL_SYS_TERM();
}
int
perl_main(int argc, char **argv, char **env)
{
int r;
if (first) {
first = 0;
PERL_SYS_INIT3(&argc, &argv, &env);
}
iperl = perl_alloc();
perl_construct(iperl);
perl_parse(iperl, xs_init, argc, argv, (char **)NULL);
+29 -28
View File
@@ -1,13 +1,13 @@
/*
* realpath -- canonicalize pathnames, resolving symlinks
*
* usage: realpath [-csv] [-a name] pathname [pathname...]
* usage: realpath [-cqsv] [-a name] pathname [pathname...]
*
* options: -a name assign each canonicalized pathname to indexed array
* variable NAME
* -c check whether or not each resolved path exists
* -s no output, exit status determines whether path is valid
* -S strip . and .. from the pathname only, no symlink resolution
* -q no output, exit status determines whether path is valid
* -s strip . and .. from the pathname only, no symlink resolution
* -v produce verbose output
*
*
@@ -22,7 +22,7 @@
*/
/*
Copyright (C) 1999-2009,2021 Free Software Foundation, Inc.
Copyright (C) 1999-2009,2021,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
@@ -66,7 +66,7 @@ extern char *sh_realpath();
int
realpath_builtin(WORD_LIST *list)
{
int opt, cflag, vflag, sflag, Sflag, aflag, es;
int opt, cflag, vflag, qflag, sflag, aflag, es;
char *r, realbuf[PATH_MAX], *p, *newpath;
struct stat sb;
#if defined (ARRAY_VARS)
@@ -80,14 +80,14 @@ realpath_builtin(WORD_LIST *list)
return (EX_USAGE);
}
vflag = cflag = sflag = aflag = Sflag = 0;
vflag = cflag = qflag = aflag = sflag = 0;
#if defined (ARRAY_VARS)
aname = NULL;
v = NULL;
ind = 0;
#endif
reset_internal_getopt();
while ((opt = internal_getopt (list, "a:Scsv")) != -1) {
while ((opt = internal_getopt (list, "a:cqsv")) != -1) {
switch (opt) {
#if defined (ARRAY_VARS)
case 'a':
@@ -98,12 +98,12 @@ realpath_builtin(WORD_LIST *list)
case 'c':
cflag = 1;
break;
case 'q':
qflag = 1;
break;
case 's':
sflag = 1;
break;
case 'S':
Sflag = 1;
break;
case 'v':
vflag = 1;
break;
@@ -146,7 +146,7 @@ realpath_builtin(WORD_LIST *list)
for (es = EXECUTION_SUCCESS; list; list = list->next) {
p = list->word->word;
if (Sflag) {
if (sflag) {
/* sh_canonpath doesn't convert to absolute pathnames */
newpath = make_absolute(p, get_string_value("PWD"));
r = sh_canonpath(newpath, PATH_CHECKDOTDOT|PATH_CHECKEXISTS);
@@ -155,27 +155,26 @@ realpath_builtin(WORD_LIST *list)
r = sh_realpath(p, realbuf);
if (r == 0) {
es = EXECUTION_FAILURE;
if (sflag == 0)
if (qflag == 0)
builtin_error("%s: cannot resolve: %s", p, strerror(errno));
continue;
}
if (cflag && (stat(r, &sb) < 0)) {
es = EXECUTION_FAILURE;
if (sflag == 0)
if (qflag == 0)
builtin_error("%s: %s", p, strerror(errno));
continue;
}
if (sflag == 0) {
if (aflag) {
bind_array_element (v, ind, r, 0);
ind++;
} else {
if (vflag)
printf ("%s -> ", p);
printf("%s\n", r);
}
if (aflag) {
bind_array_element (v, ind, r, 0);
ind++;
}
if (Sflag)
if (qflag == 0) {
if (vflag)
printf ("%s -> ", p);
printf("%s\n", r);
}
if (sflag)
free (r);
}
return es;
@@ -186,11 +185,13 @@ char *realpath_doc[] = {
"",
"Display the canonicalized version of each PATHNAME argument, resolving",
"symbolic links.",
"If the -S option is supplied, canonicalize . and .. pathname components",
"without resolving symbolic links.",
"The -a option stores each canonicalized PATHNAME argument into the indexed",
"array VARNAME.",
"The -c option checks whether or not each resolved name exists.",
"The -s option produces no output; the exit status determines the",
"validity of each PATHNAME.",
"The -q option produces no output; the exit status determines the",
"validity of each PATHNAME, but any array assignment is still performed.",
"If the -s option is supplied, canonicalize . and .. pathname components",
"without resolving symbolic links.",
"The -v option produces verbose output.",
"The exit status is 0 if each PATHNAME was resolved; non-zero otherwise.",
(char *)NULL
@@ -201,6 +202,6 @@ struct builtin realpath_struct = {
realpath_builtin, /* function implementing the builtin */
BUILTIN_ENABLED, /* initial flags for builtin */
realpath_doc, /* array of long documentation strings */
"realpath [-Scsv] pathname [pathname...]", /* usage synopsis */
"realpath [-a varname] [-cqsv] pathname [pathname...]", /* usage synopsis */
0 /* reserved for internal use */
};
+16 -6
View File
@@ -3,7 +3,7 @@
/* See Makefile for compilation details. */
/*
Copyright (C) 2016 Free Software Foundation, Inc.
Copyright (C) 2016,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
@@ -390,6 +390,12 @@ stat_builtin (list)
}
}
if (legal_identifier (aname) == 0)
{
sh_invalidid (aname);
return (EXECUTION_FAILURE);
}
list = loptend;
if (list == 0)
{
@@ -397,6 +403,10 @@ stat_builtin (list)
return (EX_USAGE);
}
#if 0
unbind_variable (aname);
#endif
fname = list->word->word;
if (getstat (fname, flags, &st) < 0)
@@ -405,8 +415,7 @@ stat_builtin (list)
return (EXECUTION_FAILURE);
}
unbind_variable (aname);
v = make_new_assoc_variable (aname);
v = find_or_make_array_variable (aname, 3);
if (v == 0)
{
builtin_error ("%s: cannot create variable", aname);
@@ -430,9 +439,10 @@ char *stat_doc[] = {
"",
"Take a filename and load the status information returned by a",
"stat(2) call on that file into the associative array specified",
"by the -A option. The default array name is STAT. If the -L",
"option is supplied, stat does not resolve symbolic links and",
"reports information about the link itself. The -l option results",
"by the -A option. The default array name is STAT.",
"",
"If the -L option is supplied, stat does not resolve symbolic links",
"and reports information about the link itself. The -l option results",
"in longer-form listings for some of the fields. When -l is used,",
"the -F option supplies a format string passed to strftime(3) to",
"display the file time information.",
+7 -7
View File
@@ -1,6 +1,6 @@
/* execute_cmd.c -- Execute a COMMAND structure. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -1650,12 +1650,12 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
default_buffered_input = -1;
#endif
#if 0
/* We can't optimize if one of the commands executed by the subshell sets
an exit trap. */
/* We can't optimize away forks if one of the commands executed by the
subshell sets an exit trap, so we set CMD_NO_FORK for simple commands
and set CMD_TRY_OPTIMIZING for simple commands on the right side of an
and-or or `;' list to test for optimizing forks when they are executed. */
if (user_subshell && command->type == cm_subshell)
optimize_subshell_command (command->value.Subshell->command);
#endif
/* Do redirections, then dispose of them before recursive call. */
if (command->redirects)
@@ -2753,7 +2753,7 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
#endif
QUIT;
optimize_fork (command); /* XXX */
optimize_connection_fork (command); /* XXX */
exec_result = execute_command_internal (command->value.Connection->second,
asynchronous, pipe_in, pipe_out,
fds_to_close);
@@ -2826,7 +2826,7 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close)
((command->value.Connection->connector == OR_OR) &&
(exec_result != EXECUTION_SUCCESS)))
{
optimize_fork (command);
optimize_connection_fork (command);
second = command->value.Connection->second;
if (ignore_return && second)
+5 -1
View File
@@ -342,7 +342,7 @@ extern char *sh_double_quote PARAMS((const char *));
extern char *sh_mkdoublequoted PARAMS((const char *, int, int));
extern char *sh_un_double_quote PARAMS((char *));
extern char *sh_backslash_quote PARAMS((char *, const char *, int));
extern char *sh_backslash_quote_for_double_quotes PARAMS((char *));
extern char *sh_backslash_quote_for_double_quotes PARAMS((char *, int));
extern char *sh_quote_reusable PARAMS((char *, int));
extern int sh_contains_shell_metas PARAMS((const char *));
extern int sh_contains_quotes PARAMS((const char *));
@@ -471,6 +471,10 @@ extern char *ansic_quote PARAMS((char *, int, int *));
extern int ansic_shouldquote PARAMS((const char *));
extern char *ansiexpand PARAMS((char *, int, int, int *));
/* declarations for functions defined in lib/sh/strvis.c */
extern int sh_charvis PARAMS((const char *, size_t *, size_t, char *, size_t *));
extern char *sh_strvis PARAMS((const char *));
/* declarations for functions defined in lib/sh/timeval.c. No prototypes
so we don't have to count on having a definition of struct timeval in
scope when this file is included. */
+25 -19
View File
@@ -1,6 +1,6 @@
/* findcmd.c -- Functions to search for commands by name. */
/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
/* Copyright (C) 1997-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -54,8 +54,8 @@ extern int errno;
/* Static functions defined and used in this file. */
static char *_find_user_command_internal PARAMS((const char *, int));
static char *find_user_command_internal PARAMS((const char *, int));
static char *find_user_command_in_path PARAMS((const char *, char *, int));
static char *find_in_path_element PARAMS((const char *, char *, int, int, struct stat *));
static char *find_user_command_in_path PARAMS((const char *, char *, int, int *));
static char *find_in_path_element PARAMS((const char *, char *, int, int, struct stat *, int *));
static char *find_absolute_program PARAMS((const char *, int));
static char *get_next_path_element PARAMS((char *, int *));
@@ -274,7 +274,7 @@ _find_user_command_internal (name, flags)
if (path_list == 0 || *path_list == '\0')
return (savestring (name));
cmd = find_user_command_in_path (name, path_list, flags);
cmd = find_user_command_in_path (name, path_list, flags, (int *)0);
return (cmd);
}
@@ -384,7 +384,7 @@ search_for_command (pathname, flags)
else
path_list = 0;
command = find_user_command_in_path (pathname, path_list, FS_EXEC_PREFERRED|FS_NODIRS);
command = find_user_command_in_path (pathname, path_list, FS_EXEC_PREFERRED|FS_NODIRS, &st);
if (command && hashing_enabled && temp_path == 0 && (flags & CMDSRCH_HASH))
{
@@ -393,7 +393,6 @@ search_for_command (pathname, flags)
table unless it's an executable file in the current directory. */
if (STREQ (command, pathname))
{
st = file_status (command);
if (st & FS_EXECABLE)
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
}
@@ -401,7 +400,6 @@ search_for_command (pathname, flags)
to the hash table. */
else if (posixly_correct || check_hashed_filenames)
{
st = file_status (command);
if (st & FS_EXECABLE)
phash_insert ((char *)pathname, command, dot_found_in_search, 1);
}
@@ -469,8 +467,7 @@ user_command_matches (name, flags, state)
if (path_element == 0)
break;
match = find_in_path_element (name, path_element, flags, name_len, &dotinfo);
match = find_in_path_element (name, path_element, flags, name_len, &dotinfo, (int *)0);
free (path_element);
if (match == 0)
@@ -523,11 +520,12 @@ find_absolute_program (name, flags)
}
static char *
find_in_path_element (name, path, flags, name_len, dotinfop)
find_in_path_element (name, path, flags, name_len, dotinfop, rflagsp)
const char *name;
char *path;
int flags, name_len;
struct stat *dotinfop;
int *rflagsp;
{
int status;
char *full_path, *xpath;
@@ -548,6 +546,9 @@ find_in_path_element (name, path, flags, name_len, dotinfop)
if (xpath != path)
free (xpath);
if (rflagsp)
*rflagsp = status;
if ((status & FS_EXISTS) == 0)
{
free (full_path);
@@ -606,19 +607,22 @@ find_in_path_element (name, path, flags, name_len, dotinfop)
FS_NODIRS: Don't find any directories.
*/
static char *
find_user_command_in_path (name, path_list, flags)
find_user_command_in_path (name, path_list, flags, rflagsp)
const char *name;
char *path_list;
int flags;
int flags, *rflagsp;
{
char *full_path, *path;
int path_index, name_len;
int path_index, name_len, rflags;
struct stat dotinfo;
/* We haven't started looking, so we certainly haven't seen
a `.' as the directory path yet. */
dot_found_in_search = 0;
if (rflagsp)
*rflagsp = 0;
if (absolute_program (name))
{
full_path = find_absolute_program (name, flags);
@@ -645,12 +649,12 @@ find_user_command_in_path (name, path_list, flags)
/* Side effects: sets dot_found_in_search, possibly sets
file_to_lose_on. */
full_path = find_in_path_element (name, path, flags, name_len, &dotinfo);
full_path = find_in_path_element (name, path, flags, name_len, &dotinfo, &rflags);
free (path);
/* This should really be in find_in_path_element, but there isn't the
right combination of flags. */
if (full_path && is_directory (full_path))
/* We use the file status flag bits to check whether full_path is a
directory, which we reject here. */
if (full_path && (rflags & FS_DIRECTORY))
{
free (full_path);
continue;
@@ -658,6 +662,8 @@ find_user_command_in_path (name, path_list, flags)
if (full_path)
{
if (rflagsp)
*rflagsp = rflags;
FREE (file_to_lose_on);
return (full_path);
}
@@ -669,7 +675,7 @@ find_user_command_in_path (name, path_list, flags)
search would accept a non-executable as a last resort. If the
caller specified FS_NODIRS, and file_to_lose_on is a directory,
return NULL. */
if (file_to_lose_on && (flags & FS_NODIRS) && is_directory (file_to_lose_on))
if (file_to_lose_on && (flags & FS_NODIRS) && file_isdir (file_to_lose_on))
{
free (file_to_lose_on);
file_to_lose_on = (char *)NULL;
@@ -686,5 +692,5 @@ find_in_path (name, path_list, flags)
char *path_list;
int flags;
{
return (find_user_command_in_path (name, path_list, flags));
return (find_user_command_in_path (name, path_list, flags, (int *)0));
}
+1 -1
View File
@@ -103,7 +103,7 @@
#endif
#ifndef UNCTRL
/* control char to letter -- ASCII */
# define UNCTRL(x) (TOUPPER(x) ^ 0x40)
# define UNCTRL(x) (TOUPPER(x ^ 0x40))
#endif
#endif /* _SH_CHARTYPES_H */
+11 -3
View File
@@ -318,9 +318,11 @@ extern int locale_utf8locale; /* XXX */
size_t mblength; \
int _k; \
\
_k = is_basic (*((_src) + (_si))); \
_k = is_basic ((_src)[(_si)]); \
if (_k) \
mblength = 1; \
else if (locale_utf8locale && ((_src)[(_si)] & 0x80) == 0) \
mblength = (_src)[(_si)] != 0; \
else \
{\
state_bak = state; \
@@ -361,9 +363,11 @@ extern int locale_utf8locale; /* XXX */
size_t mblength; \
int _i; \
\
_i = is_basic (*((_src) + (_si))); \
_i = is_basic ((_src)[(_si)]); \
if (_i) \
mblength = 1; \
else if (locale_utf8locale && ((_src)[(_si)] & 0x80) == 0) \
mblength = (_src)[(_si)] != 0; \
else \
{ \
state_bak = state; \
@@ -411,6 +415,8 @@ extern int locale_utf8locale; /* XXX */
_i = is_basic (*((_src) + (_si))); \
if (_i) \
mblength = 1; \
else if (locale_utf8locale && (((_src)[_si] & 0x80) == 0)) \
mblength = (_src)[_si] != 0; \
else \
{ \
state_bak = state; \
@@ -527,7 +533,9 @@ extern int locale_utf8locale; /* XXX */
i = is_basic (*((_src) + (_si))); \
if (i) \
mblength = 1; \
else \
else if (locale_utf8locale && (((_src)[_si] & 0x80) == 0)) \
mblength = (_src)[_si] != 0; \
else \
{ \
state_bak = state; \
mblength = mbrlen ((_src) + (_si), (_srcsize) - (_si), &state); \
+9 -6
View File
@@ -3,7 +3,7 @@
/* This file works with both POSIX and BSD systems. It implements job
control. */
/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -2644,16 +2644,16 @@ wait_for_single_pid (pid, flags)
}
/* Wait for all of the background processes started by this shell to finish. */
void
int
wait_for_background_pids (ps)
struct procstat *ps;
{
register int i, r;
int any_stopped, check_async;
int any_stopped, check_async, njobs;
sigset_t set, oset;
pid_t pid;
for (any_stopped = 0, check_async = 1;;)
for (njobs = any_stopped = 0, check_async = 1;;)
{
BLOCK_CHILD (set, oset);
@@ -2698,6 +2698,7 @@ wait_for_background_pids (ps)
check_async = 0;
mark_all_jobs_as_dead ();
}
njobs++;
}
#if defined (PROCESS_SUBSTITUTION)
@@ -2709,6 +2710,8 @@ wait_for_background_pids (ps)
mark_dead_jobs_as_notified (1);
cleanup_dead_jobs ();
bgp_clear ();
return njobs;
}
/* Make OLD_SIGINT_HANDLER the SIGINT signal handler. */
@@ -3114,8 +3117,8 @@ if (job == NO_JOB)
else
#if defined (READLINE)
/* We don't want to do this if we are running a process during
programmable completion. */
if (RL_ISSTATE (RL_STATE_COMPLETING) == 0)
programmable completion or a command bound to `bind -x'. */
if (RL_ISSTATE (RL_STATE_COMPLETING|RL_STATE_DISPATCHING|RL_STATE_TERMPREPPED) == 0)
#endif
get_tty_state ();
+2 -2
View File
@@ -1,6 +1,6 @@
/* jobs.h -- structures and definitions used by the jobs.c file. */
/* Copyright (C) 1993-2019 Free Software Foundation, Inc.
/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -279,7 +279,7 @@ extern int job_exit_status PARAMS((int));
extern int job_exit_signal PARAMS((int));
extern int wait_for_single_pid PARAMS((pid_t, int));
extern void wait_for_background_pids PARAMS((struct procstat *));
extern int wait_for_background_pids PARAMS((struct procstat *));
extern int wait_for PARAMS((pid_t, int));
extern int wait_for_job PARAMS((int, int, struct procstat *));
extern int wait_for_any_job PARAMS((int, struct procstat *));
+15 -3
View File
@@ -818,8 +818,7 @@ glob_vector (pat, dir, flags)
add_current = ((flags & (GX_ALLDIRS|GX_ADDCURDIR)) == (GX_ALLDIRS|GX_ADDCURDIR));
/* Scan the directory, finding all names that match.
For each name that matches, allocate a struct globval
/* Scan the directory, finding all names that match For each name that matches, allocate a struct globval
on the stack and store the name in it.
Chain those structs together; lastlink is the front of the chain. */
while (1)
@@ -901,6 +900,9 @@ glob_vector (pat, dir, flags)
nextname = (char *) malloc (sdlen + 1);
if (nextlink == 0 || nextname == 0)
{
if (firstmalloc && firstmalloc == nextlink)
firstmalloc = 0;
/* If we reset FIRSTMALLOC we can free this here. */
FREE (nextlink);
FREE (nextname);
free (subdir);
@@ -936,8 +938,18 @@ glob_vector (pat, dir, flags)
nextname = (char *) malloc (D_NAMLEN (dp) + 1);
if (nextlink == 0 || nextname == 0)
{
/* We free NEXTLINK here, since it won't be added to the
LASTLINK chain. If we used malloc, and it returned non-
NULL, firstmalloc will be set to something valid. If it's
NEXTLINK, reset it before we free NEXTLINK to avoid
duplicate frees. If not, it will be taken care of by the
loop below with TMPLINK. */
if (firstmalloc)
FREE (nextlink);
{
if (firstmalloc == nextlink)
firstmalloc = 0;
FREE (nextlink);
}
FREE (nextname);
lose = 1;
break;
+17 -1
View File
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 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.
@@ -1983,6 +1983,8 @@ typedef int _rl_sv_func_t (const char *);
#define V_INT 2
/* Forward declarations */
static int sv_region_start_color (const char *);
static int sv_region_end_color (const char *);
static int sv_bell_style (const char *);
static int sv_combegin (const char *);
static int sv_dispprefix (const char *);
@@ -2002,6 +2004,8 @@ static const struct {
int flags;
_rl_sv_func_t *set_func;
} string_varlist[] = {
{ "active-region-end-color", V_STRING, sv_region_end_color },
{ "active-region-start-color", V_STRING, sv_region_start_color },
{ "bell-style", V_STRING, sv_bell_style },
{ "comment-begin", V_STRING, sv_combegin },
{ "completion-display-width", V_INT, sv_compwidth },
@@ -2220,6 +2224,18 @@ sv_seqtimeout (const char *value)
return 0;
}
static int
sv_region_start_color (const char *value)
{
return (_rl_reset_region_color (0, value));
}
static int
sv_region_end_color (const char *value)
{
return (_rl_reset_region_color (1, value));
}
static int
sv_bell_style (const char *value)
{
+7 -1
View File
@@ -1,6 +1,6 @@
/* callback.c -- functions to use readline as an X `callback' mechanism. */
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 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.
@@ -136,6 +136,8 @@ rl_callback_read_char (void)
abort ();
}
eof = 0;
memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
#if defined (HAVE_POSIX_SIGSETJMP)
jcode = sigsetjmp (_rl_top_level, 0);
@@ -276,6 +278,10 @@ rl_callback_read_char (void)
_rl_want_redisplay = 0;
}
/* Make sure application hooks can see whether we saw EOF. */
if (rl_eof_found = eof)
RL_SETSTATE(RL_STATE_EOF);
if (rl_done)
{
line = readline_internal_teardown (eof);
+1 -1
View File
@@ -1981,7 +1981,7 @@ compare_match (char *text, const char *match)
{
temp = (*rl_filename_dequoting_function) (text, rl_completion_quote_character);
r = strcmp (temp, match);
free (temp);
xfree (temp);
return r;
}
return (strcmp (text, match));
+13 -5
View File
@@ -1,6 +1,6 @@
/* display.c -- readline redisplay facility. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 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.
@@ -439,7 +439,15 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp)
to add them, since update_line expects them to be counted before
wrapping the line. */
if (can_add_invis)
local_prompt_newlines[newlines] = r - ret;
{
local_prompt_newlines[newlines] = r - ret;
/* If we're adding to the number of invisible characters on the
first line of the prompt, but we've already set the number of
invisible characters on that line, we need to adjust the
counter. */
if (invflset && newlines == 1)
invfl = ninvis;
}
if (p != (igstart + 1))
last = r - ret - 1;
continue;
@@ -528,7 +536,7 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp)
*vlp = physchars;
if (nprompt != pmt)
free (nprompt);
xfree (nprompt);
return ret;
}
@@ -1595,9 +1603,9 @@ putc_face (int c, int face, char *cur_face)
if (face != FACE_NORMAL && face != FACE_STANDOUT)
return;
if (face == FACE_STANDOUT && cf == FACE_NORMAL)
_rl_standout_on ();
_rl_region_color_on ();
if (face == FACE_NORMAL && cf == FACE_STANDOUT)
_rl_standout_off ();
_rl_region_color_off ();
*cur_face = face;
}
if (c != EOF)
+1 -1
View File
@@ -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--2020 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2022 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+1 -1
View File
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
+1 -1
View File
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988--2020 Free Software Foundation, Inc.
Copyright (C) 1988--2022 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
+1 -1
View File
@@ -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--2020 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2022 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+19 -5
View File
@@ -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--2020 Free Software Foundation, Inc.
Copyright (C) 1988--2022 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -323,6 +323,14 @@ and point define a @emph{region}.
@deftypevar int rl_done
Setting this to a non-zero value causes Readline to return the current
line immediately.
Readline will set this variable when it has read a key sequence bound
to @code{accept-line} and is about to return the line to the caller.
@end deftypevar
@deftypevar int rl_eof_found
Readline will set this variable when it has read an EOF character (e.g., the
stty @samp{EOF} character) on an empty line or encountered a read error and
is about to return a NULL line to the caller.
@end deftypevar
@deftypevar int rl_num_chars_to_read
@@ -597,6 +605,9 @@ and is about to return the line to the caller.
Readline has timed out (it did not receive a line or specified number of
characters before the timeout duration specified by @code{rl_set_timeout}
elapsed) and is returning that status to the caller.
@item RL_STATE_EOF
Readline has read an EOF character (e.g., the stty @samp{EOF} character)
or encountered a read error and is about to return a NULL line to the caller.
@end table
@end deftypevar
@@ -1184,10 +1195,13 @@ Returns 0 if the timeout is set successfully.
@deftypefun int rl_timeout_remaining (unsigned int *secs, unsigned int *usecs)
Return the number of seconds and microseconds remaining in the current
timeout duration in @code{*secs} and @code{*usecs}, respectively.
Returns -1 on error or when there is no timeout set, 0 when the timeout has
expired (leaving @code{*secs} and @code{*usecs} unchanged), and 1 if the
timeout has not expired. If @code{secs} and @code{usecs} are @code{NULL},
timeout duration in @var{*secs} and @var{*usecs}, respectively.
Both @var{*secs} and @var{*usecs} must be non-NULL to return any values.
The return value is -1 on error or when there is no timeout set,
0 when the timeout has expired (leaving @var{*secs} and @var{*usecs}
unchanged),
and 1 if the timeout has not expired.
If either of @var{secs} and @var{usecs} is @code{NULL},
the return value indicates whether the timeout has expired.
@end deftypefun
+36 -6
View File
@@ -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--2020 Free Software Foundation, Inc.
Copyright (C) 1988--2022 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -419,6 +419,32 @@ variables.
@cindex variables, readline
@table @code
@item active-region-start-color
@vindex active-region-start-color
A string variable that controls the text color and background when displaying
the text in the active region (see the description of
@code{enable-active-region} below).
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal before displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that puts the terminal in standout mode,
as obtained from the terminal's terminfo description.
A sample value might be @samp{\e[01;33m}.
@item active-region-end-color
@vindex active-region-end-color
A string variable that "undoes" the effects of @code{active-region-start-color}
and restores "normal" terminal display appearance after displaying text
in the active region.
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal after displaying the text in the active region.
This variable is reset to the default value whenever the terminal type changes.
The default value is the string that restores the terminal from standout mode,
as obtained from the terminal's terminfo description.
A sample value might be @samp{\e[0m}.
@item bell-style
@vindex bell-style
Controls what happens when Readline wants to ring the terminal bell.
@@ -553,6 +579,8 @@ The text between the point and mark is referred to as the @dfn{region}.
When this variable is set to @samp{On}, Readline allows certain commands
to designate the region as @dfn{active}.
When the region is active, Readline highlights the text in the region using
the value of the @code{active-region-start-color}, which defaults to the
string that enables
the terminal's standout mode.
The active region shows the text inserted by bracketed-paste and any
matching text found by incremental and non-incremental history searches.
@@ -560,11 +588,13 @@ The default is @samp{On}.
@item enable-bracketed-paste
@vindex enable-bracketed-paste
When set to @samp{On}, Readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
from being interpreted as editing commands. The default is @samp{On}.
When set to @samp{On}, Readline configures the terminal to insert each
paste into the editing buffer as a single string of characters, instead
of treating each character as if it had been read from the keyboard.
This is called putting the terminal into @dfn{bracketed paste mode};
it prevents Readline from executing any editing commands bound to key
sequences appearing in the pasted text.
The default is @samp{On}.
@item enable-keypad
@vindex enable-keypad
+1 -1
View File
@@ -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--2020 Free Software Foundation, Inc.
Copyright @copyright{} 1988--2022 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
+7 -6
View File
@@ -1,10 +1,11 @@
@ignore
Copyright (C) 1988-2021 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
@end ignore
@set EDITION 8.1
@set VERSION 8.1
@set UPDATED 15 November 2021
@set UPDATED-MONTH November 2021
@set EDITION 8.2
@set VERSION 8.2
@set LASTCHANGE Mon Nov 15 17:05:28 EST 2021
@set UPDATED 11 March 2022
@set UPDATED-MONTH March 2022
@set LASTCHANGE Fri Mar 11 10:13:51 EST 2022
+1 -1
View File
@@ -310,7 +310,7 @@ read_history_range (const char *filename, int from, int to)
if (file_size == 0)
{
free (input);
xfree (input);
close (file);
return 0; /* don't waste time if we don't have to */
}
+2 -1
View File
@@ -1,6 +1,6 @@
/* histlib.h -- internal definitions for the history library. */
/* Copyright (C) 1989-2009,2021 Free Software Foundation, Inc.
/* Copyright (C) 1989-2009,2021-2022 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -84,6 +84,7 @@ extern int _hs_history_patsearch (const char *, int, int);
/* history.c */
extern void _hs_replace_history_data (int, histdata_t *, histdata_t *);
extern int _hs_at_end_of_history (void);
/* histfile.c */
extern void _hs_append_history_line (int, const char *);
+7
View File
@@ -165,6 +165,13 @@ history_set_pos (int pos)
history_offset = pos;
return (1);
}
/* Are we currently at the end of the history list? */
int
_hs_at_end_of_history (void)
{
return (the_history == 0 || history_offset == history_length);
}
/* Return the current history array. The caller has to be careful, since this
is the actual array of data, and could be bashed or made corrupt easily.
+2 -2
View File
@@ -1,6 +1,6 @@
/* history.h -- the names of functions that you can call in history. */
/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -44,7 +44,7 @@ typedef char *histdata_t;
/* Let's not step on anyone else's define for now, since we don't use this yet. */
#ifndef HS_HISTORY_VERSION
# define HS_HISTORY_VERSION 0x0801 /* History 8.1 */
# define HS_HISTORY_VERSION 0x0802 /* History 8.2 */
#endif
/* The structure used to store a history entry. */
+1 -1
View File
@@ -248,7 +248,7 @@ _hs_history_patsearch (const char *string, int direction, int flags)
ret = history_search_internal (pat, direction, flags|PATTERN_SEARCH);
if (pat != string)
free (pat);
xfree (pat);
return ret;
}
+2 -2
View File
@@ -679,7 +679,7 @@ opcode_dispatch:
paste = _rl_bracketed_text (&pastelen);
if (paste == 0 || *paste == 0)
{
free (paste);
xfree (paste);
break;
}
if (_rl_enable_active_region)
@@ -692,7 +692,7 @@ opcode_dispatch:
memcpy (cxt->search_string + cxt->search_string_index, paste, pastelen);
cxt->search_string_index += pastelen;
cxt->search_string[cxt->search_string_index] = '\0';
free (paste);
xfree (paste);
break;
/* Add character to search string and continue search. */
+5 -1
View File
@@ -1,6 +1,6 @@
/* misc.c -- miscellaneous bindable readline functions. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 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.
@@ -50,6 +50,7 @@
#include "history.h"
#include "rlprivate.h"
#include "histlib.h"
#include "rlshell.h"
#include "xmalloc.h"
@@ -308,6 +309,7 @@ _rl_start_using_history (void)
if (_rl_saved_line_for_history)
_rl_free_saved_history_line ();
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
_rl_history_search_pos = -99; /* some random invalid history position */
}
/* Free the contents (and containing structure) of a HIST_ENTRY. */
@@ -380,6 +382,8 @@ rl_maybe_save_line (void)
int
_rl_free_saved_history_line (void)
{
UNDO_LIST *orig;
if (_rl_saved_line_for_history)
{
if (rl_undo_list && rl_undo_list == (UNDO_LIST *)_rl_saved_line_for_history->data)
+2 -1
View File
@@ -1,6 +1,6 @@
/* nls.c -- skeletal internationalization code. */
/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
/* Copyright (C) 1996-2022 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.
@@ -53,6 +53,7 @@
#include "readline.h"
#include "rlshell.h"
#include "rlprivate.h"
#include "xmalloc.h"
static int utf8locale (char *);
+23 -8
View File
@@ -1,7 +1,7 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 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.
@@ -164,6 +164,9 @@ int rl_end;
/* Make this non-zero to return the current input_line. */
int rl_done;
/* If non-zero when readline_internal returns, it means we found EOF */
int rl_eof_found = 0;
/* The last function executed by readline. */
rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL;
@@ -217,9 +220,6 @@ int _rl_eof_char = CTRL ('D');
/* Non-zero makes this the next keystroke to read. */
int rl_pending_input = 0;
/* If non-zero when readline_internal returns, it means we found EOF */
int _rl_eof_found = 0;
/* Pointer to a useful terminal name. */
const char *rl_terminal_name = (const char *)NULL;
@@ -240,6 +240,9 @@ char *_rl_comment_begin;
/* Keymap holding the function currently being executed. */
Keymap rl_executing_keymap;
/* The function currently being executed. */
rl_command_func_t *_rl_executing_func;
/* Keymap we're currently using to dispatch. */
Keymap _rl_dispatching_keymap;
@@ -479,12 +482,18 @@ readline_internal_teardown (int eof)
RL_CHECK_SIGNALS ();
if (eof)
RL_SETSTATE (RL_STATE_EOF); /* XXX */
/* Restore the original of this history line, iff the line that we
are editing was originally in the history, AND the line has changed. */
entry = current_history ();
/* We don't want to do this if we executed functions that call
history_set_pos to set the history offset to the line containing the
non-incremental search string. */
if (entry && rl_undo_list)
{
{
temp = savestring (the_line);
rl_revert_line (1, 0);
entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL);
@@ -615,6 +624,7 @@ readline_internal_charloop (void)
RL_SETSTATE(RL_STATE_DONE);
return (rl_done = 1);
#else
RL_SETSTATE(RL_STATE_EOF);
eof_found = 1;
break;
#endif
@@ -655,6 +665,7 @@ readline_internal_charloop (void)
RL_SETSTATE(RL_STATE_DONE);
return (rl_done = 1);
#else
RL_SETSTATE(RL_STATE_EOF);
eof_found = 1;
break;
#endif
@@ -671,6 +682,8 @@ readline_internal_charloop (void)
rl_executing_keymap = _rl_command_to_execute->map;
rl_executing_key = _rl_command_to_execute->key;
_rl_executing_func = _rl_command_to_execute->func;
rl_dispatching = 1;
RL_SETSTATE(RL_STATE_DISPATCHING);
r = (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key);
@@ -717,8 +730,8 @@ static char *
readline_internal (void)
{
readline_internal_setup ();
_rl_eof_found = readline_internal_charloop ();
return (readline_internal_teardown (_rl_eof_found));
rl_eof_found = readline_internal_charloop ();
return (readline_internal_teardown (rl_eof_found));
}
void
@@ -892,6 +905,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
rl_executing_keymap = map;
rl_executing_key = key;
_rl_executing_func = func;
RESIZE_KEYSEQ_BUFFER();
rl_executing_keyseq[rl_key_sequence_length++] = key;
rl_executing_keyseq[rl_key_sequence_length] = '\0';
@@ -1178,7 +1193,7 @@ rl_initialize (void)
/* We aren't done yet. We haven't even gotten started yet! */
rl_done = 0;
RL_UNSETSTATE(RL_STATE_DONE);
RL_UNSETSTATE(RL_STATE_DONE|RL_STATE_TIMEOUT|RL_STATE_EOF);
/* Tell the history routines what is going on. */
_rl_start_using_history ();
+9 -4
View File
@@ -1,6 +1,6 @@
/* Readline.h -- the names of functions callable from within readline. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 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.
@@ -39,9 +39,9 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
#define RL_READLINE_VERSION 0x0801 /* Readline 8.1 */
#define RL_READLINE_VERSION 0x0802 /* Readline 8.2 */
#define RL_VERSION_MAJOR 8
#define RL_VERSION_MINOR 1
#define RL_VERSION_MINOR 2
/* Readline data structures. */
@@ -562,6 +562,10 @@ extern int rl_mark;
line and should return it. */
extern int rl_done;
/* Flag to indicate that readline has read an EOF character or read has
returned 0 or error, and is returning a NULL line as a result. */
extern int rl_eof_found;
/* If set to a character value, that will be the next keystroke read. */
extern int rl_pending_input;
@@ -917,7 +921,8 @@ extern int rl_persistent_signal_handlers;
#define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
#define RL_STATE_DONE 0x2000000 /* done; accepted line */
#define RL_STATE_TIMEOUT 0x4000000
#define RL_STATE_TIMEOUT 0x4000000 /* done; timed out */
#define RL_STATE_EOF 0x8000000 /* done; got eof on read */
#define RL_SETSTATE(x) (rl_readline_state |= (x))
#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
+9 -2
View File
@@ -1,7 +1,7 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
/* Copyright (C) 1999-2022 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.
@@ -381,6 +381,8 @@ extern void _rl_end_executing_keyseq (void);
extern void _rl_add_executing_keyseq (int);
extern void _rl_del_executing_keyseq (void);
extern rl_command_func_t *_rl_executing_func;
/* rltty.c */
extern int _rl_disable_tty_signals (void);
extern int _rl_restore_tty_signals (void);
@@ -415,6 +417,9 @@ extern void _rl_control_keypad (int);
extern void _rl_set_cursor (int, int);
extern void _rl_standout_on (void);
extern void _rl_standout_off (void);
extern int _rl_reset_region_color (int, const char *);
extern void _rl_region_color_on (void);
extern void _rl_region_color_off (void);
/* text.c */
extern void _rl_fix_point (int);
@@ -551,6 +556,8 @@ extern int _rl_echo_control_chars;
extern int _rl_show_mode_in_prompt;
extern int _rl_enable_bracketed_paste;
extern int _rl_enable_active_region;
extern char *_rl_active_region_start_color;
extern char *_rl_active_region_end_color;
extern char *_rl_comment_begin;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
@@ -558,7 +565,6 @@ extern FILE *_rl_in_stream;
extern FILE *_rl_out_stream;
extern int _rl_last_command_was_kill;
extern int _rl_eof_char;
extern int _rl_eof_found;
extern procenv_t _rl_top_level;
extern _rl_keyseq_cxt *_rl_kscxt;
extern int _rl_keyseq_timeout;
@@ -569,6 +575,7 @@ extern rl_hook_func_t *_rl_internal_startup_hook;
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
extern int _rl_history_search_pos;
/* signals.c */
extern int volatile _rl_caught_signal;
+4 -2
View File
@@ -1,7 +1,7 @@
/* rltty.c -- functions to prepare and restore the terminal for readline's
use. */
/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
/* Copyright (C) 1992-2022 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.
@@ -692,7 +692,9 @@ rl_deprep_terminal (void)
if (terminal_prepped & TPX_BRACKPASTE)
{
fprintf (rl_outstream, BRACK_PASTE_FINI);
if (_rl_eof_found && (RL_ISSTATE (RL_STATE_TIMEOUT) == 0))
/* Since the last character in BRACK_PASTE_FINI is \r */
_rl_last_c_pos = 0;
if (rl_eof_found && (RL_ISSTATE (RL_STATE_TIMEOUT) == 0))
fprintf (rl_outstream, "\n");
else if (_rl_echoing_p == 0)
fprintf (rl_outstream, "\n");
+37 -35
View File
@@ -1,6 +1,6 @@
/* search.c - code for non-incremental searching in emacs and vi modes. */
/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
/* Copyright (C) 1992-2022 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.
@@ -60,9 +60,9 @@ static int noninc_history_pos;
static char *prev_line_found = (char *) NULL;
static int rl_history_search_len;
static int rl_history_search_pos;
static int rl_history_search_flags;
static int _rl_history_search_len;
/*static*/ int _rl_history_search_pos;
static int _rl_history_search_flags;
static char *history_search_string;
static int history_string_size;
@@ -84,9 +84,12 @@ static int _rl_nsearch_dispatch (_rl_search_cxt *, int);
static void
make_history_line_current (HIST_ENTRY *entry)
{
UNDO_LIST *xlist;
xlist = _rl_saved_line_for_history ? (UNDO_LIST *)_rl_saved_line_for_history->data : 0;
/* At this point, rl_undo_list points to a private search string list. */
if (rl_undo_list && rl_undo_list != (UNDO_LIST *)entry->data)
rl_free_undo_list ();
if (rl_undo_list && rl_undo_list != (UNDO_LIST *)entry->data && rl_undo_list != xlist)
rl_free_undo_list ();
/* Now we create a new undo list with a single insert for this text.
WE DON'T CHANGE THE ORIGINAL HISTORY ENTRY UNDO LIST */
@@ -102,9 +105,13 @@ make_history_line_current (HIST_ENTRY *entry)
#endif
/* This will need to free the saved undo list associated with the original
(pre-search) line buffer. */
(pre-search) line buffer.
XXX - look at _rl_free_saved_history_line and consider calling it if
rl_undo_list != xlist (or calling rl_free_undo list directly on
_rl_saved_line_for_history->data) */
if (_rl_saved_line_for_history)
_rl_free_saved_history_line ();
_rl_free_history_entry (_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
}
/* Search the history list for STRING starting at absolute history position
@@ -523,12 +530,11 @@ rl_history_search_internal (int count, int dir)
{
HIST_ENTRY *temp;
int ret, oldpos, newcol;
int had_saved_line;
char *t;
had_saved_line = _rl_saved_line_for_history != 0;
rl_maybe_save_line ();
/* This will either be restored from the saved line or set from the
found history line. */
rl_undo_list = 0;
temp = (HIST_ENTRY *)NULL;
/* Search COUNT times through the history for a line matching
@@ -539,14 +545,14 @@ rl_history_search_internal (int count, int dir)
while (count)
{
RL_CHECK_SIGNALS ();
ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir, 0, &newcol);
ret = noninc_search_from_pos (history_search_string, _rl_history_search_pos + dir, dir, 0, &newcol);
if (ret == -1)
break;
/* Get the history entry we found. */
rl_history_search_pos = ret;
_rl_history_search_pos = ret;
oldpos = where_history ();
history_set_pos (rl_history_search_pos);
history_set_pos (_rl_history_search_pos);
temp = current_history (); /* will never be NULL after successful search */
history_set_pos (oldpos);
@@ -560,20 +566,21 @@ rl_history_search_internal (int count, int dir)
/* If we didn't find anything at all, return. */
if (temp == 0)
{
/* XXX - check had_saved_line here? */
rl_maybe_unsave_line ();
rl_ding ();
/* If you don't want the saved history line (last match) to show up
in the line buffer after the search fails, change the #if 0 to
#if 1 */
#if 0
if (rl_point > rl_history_search_len)
if (rl_point > _rl_history_search_len)
{
rl_point = rl_end = rl_history_search_len;
rl_point = rl_end = _rl_history_search_len;
rl_line_buffer[rl_end] = '\0';
rl_mark = 0;
}
#else
rl_point = rl_history_search_len; /* rl_maybe_unsave_line changes it */
rl_point = _rl_history_search_len; /* rl_maybe_unsave_line changes it */
rl_mark = rl_end;
#endif
return 1;
@@ -582,19 +589,14 @@ rl_history_search_internal (int count, int dir)
/* Copy the line we found into the current line buffer. */
make_history_line_current (temp);
/* Make sure we set the current history position to the last line found so
we can do things like operate-and-get-next from here. This is similar to
how incremental search behaves. */
history_set_pos (rl_history_search_pos); /* XXX */
/* decide where to put rl_point -- need to change this for pattern search */
if (rl_history_search_flags & ANCHORED_SEARCH)
rl_point = rl_history_search_len; /* easy case */
if (_rl_history_search_flags & ANCHORED_SEARCH)
rl_point = _rl_history_search_len; /* easy case */
else
{
#if 0
t = strstr (rl_line_buffer, history_search_string); /* XXX */
rl_point = t ? (int)(t - rl_line_buffer) + rl_history_search_len : rl_end;
rl_point = t ? (int)(t - rl_line_buffer) + _rl_history_search_len : rl_end;
#else
rl_point = (newcol >= 0) ? newcol : rl_end;
#endif
@@ -609,17 +611,17 @@ rl_history_search_reinit (int flags)
{
int sind;
rl_history_search_pos = where_history ();
rl_history_search_len = rl_point;
rl_history_search_flags = flags;
_rl_history_search_pos = where_history ();
_rl_history_search_len = rl_point;
_rl_history_search_flags = flags;
prev_line_found = (char *)NULL;
if (rl_point)
{
/* Allocate enough space for anchored and non-anchored searches */
if (rl_history_search_len >= history_string_size - 2)
if (_rl_history_search_len >= history_string_size - 2)
{
history_string_size = rl_history_search_len + 2;
history_string_size = _rl_history_search_len + 2;
history_search_string = (char *)xrealloc (history_search_string, history_string_size);
}
sind = 0;
@@ -628,7 +630,7 @@ rl_history_search_reinit (int flags)
strncpy (history_search_string + sind, rl_line_buffer, rl_point);
history_search_string[rl_point + sind] = '\0';
}
_rl_free_saved_history_line ();
_rl_free_saved_history_line (); /* XXX rl_undo_list? */
}
/* Search forward in the history for the string of characters
@@ -644,7 +646,7 @@ rl_history_search_forward (int count, int ignore)
rl_last_func != rl_history_search_backward)
rl_history_search_reinit (ANCHORED_SEARCH);
if (rl_history_search_len == 0)
if (_rl_history_search_len == 0)
return (rl_get_next_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
}
@@ -662,7 +664,7 @@ rl_history_search_backward (int count, int ignore)
rl_last_func != rl_history_search_backward)
rl_history_search_reinit (ANCHORED_SEARCH);
if (rl_history_search_len == 0)
if (_rl_history_search_len == 0)
return (rl_get_previous_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
}
@@ -681,7 +683,7 @@ rl_history_substr_search_forward (int count, int ignore)
rl_last_func != rl_history_substr_search_backward)
rl_history_search_reinit (NON_ANCHORED_SEARCH);
if (rl_history_search_len == 0)
if (_rl_history_search_len == 0)
return (rl_get_next_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
}
@@ -699,7 +701,7 @@ rl_history_substr_search_backward (int count, int ignore)
rl_last_func != rl_history_substr_search_backward)
rl_history_search_reinit (NON_ANCHORED_SEARCH);
if (rl_history_search_len == 0)
if (_rl_history_search_len == 0)
return (rl_get_previous_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
}
+83 -4
View File
@@ -1,6 +1,6 @@
/* terminal.c -- controlling the terminal with termcap. */
/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
/* Copyright (C) 1996-2022 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.
@@ -185,6 +185,11 @@ static char *_rl_term_kN;
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
/* User-settable color sequences to begin and end the active region. Defaults
are rl_term_so and rl_term_se on non-dumb terminals. */
char *_rl_active_region_start_color = NULL;
char *_rl_active_region_end_color = NULL;
/* It's not clear how HPUX is so broken here. */
#ifdef TGETENT_BROKEN
# define TGETENT_SUCCESS 0
@@ -466,7 +471,7 @@ _rl_init_terminal_io (const char *terminal_name)
{
const char *term;
char *buffer;
int tty, tgetent_ret, dumbterm;
int tty, tgetent_ret, dumbterm, reset_region_colors;
term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = _rl_term_clrscroll = (char *)NULL;
@@ -477,6 +482,8 @@ _rl_init_terminal_io (const char *terminal_name)
dumbterm = STREQ (term, "dumb");
reset_region_colors = 1;
#ifdef __MSDOS__
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
@@ -562,6 +569,11 @@ _rl_init_terminal_io (const char *terminal_name)
escape sequences */
_rl_enable_bracketed_paste = 0;
/* No terminal so/se capabilities. */
_rl_enable_active_region = 0;
_rl_reset_region_color (0, NULL);
_rl_reset_region_color (1, NULL);
/* Reasonable defaults for tgoto(). Readline currently only uses
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
@@ -616,8 +628,14 @@ _rl_init_terminal_io (const char *terminal_name)
/* There's no way to determine whether or not a given terminal supports
bracketed paste mode, so we assume a terminal named "dumb" does not. */
if (dumbterm)
_rl_enable_bracketed_paste = 0;
_rl_enable_bracketed_paste = _rl_enable_active_region = 0;
if (reset_region_colors)
{
_rl_reset_region_color (0, _rl_term_so);
_rl_reset_region_color (1, _rl_term_se);
}
return 0;
}
@@ -789,6 +807,67 @@ _rl_standout_off (void)
#endif
}
/* **************************************************************** */
/* */
/* Controlling color for a portion of the line */
/* */
/* **************************************************************** */
/* Reset the region color variables to VALUE depending on WHICH (0 == start,
1 == end). This is where all the memory allocation for the color variable
strings is performed. We might want to pass a flag saying whether or not
to translate VALUE like a key sequence, but it doesn't really matter. */
int
_rl_reset_region_color (int which, const char *value)
{
int len;
if (which == 0)
{
xfree (_rl_active_region_start_color);
if (value && *value)
{
_rl_active_region_start_color = (char *)xmalloc (2 * strlen (value) + 1);
rl_translate_keyseq (value, _rl_active_region_start_color, &len);
_rl_active_region_start_color[len] = '\0';
}
else
_rl_active_region_start_color = NULL;
}
else
{
xfree (_rl_active_region_end_color);
if (value && *value)
{
_rl_active_region_end_color = (char *)xmalloc (2 * strlen (value) + 1);
rl_translate_keyseq (value, _rl_active_region_end_color, &len);
_rl_active_region_end_color[len] = '\0';
}
else
_rl_active_region_end_color = NULL;
}
return 0;
}
void
_rl_region_color_on (void)
{
#ifndef __MSDOS__
if (_rl_active_region_start_color && _rl_active_region_end_color)
tputs (_rl_active_region_start_color, 1, _rl_output_character_function);
#endif
}
void
_rl_region_color_off (void)
{
#ifndef __MSDOS__
if (_rl_active_region_start_color && _rl_active_region_end_color)
tputs (_rl_active_region_end_color, 1, _rl_output_character_function);
#endif
}
/* **************************************************************** */
/* */
/* Controlling the Meta Key and Keypad */
+10 -3
View File
@@ -2,7 +2,7 @@
# Makefile for the Bash library
#
#
# Copyright (C) 1998-2020 Free Software Foundation, Inc.
# Copyright (C) 1998-2022 Free Software Foundation, Inc.
# 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
@@ -94,7 +94,7 @@ CSOURCES = clktck.c clock.c getcwd.c getenv.c oslib.c setlinebuf.c \
wcsdup.c fpurge.c zgetline.c mbscmp.c uconvert.c ufuncs.c \
casemod.c dprintf.c input_avail.c mbscasecmp.c fnxform.c \
strchrnul.c unicode.c wcswidth.c wcsnwidth.c shmbchar.c strdup.c \
utf8.c random.c gettimeofday.c timers.c
strvis.c utf8.c random.c gettimeofday.c timers.c
# The header files for this library.
HSOURCES =
@@ -108,7 +108,7 @@ OBJECTS = clktck.o clock.o getenv.o oslib.o setlinebuf.o strnlen.o \
strtrans.o snprintf.o mailstat.o fmtulong.o \
fmtullong.o fmtumax.o zcatfd.o zmapfd.o winsize.o wcsdup.o \
fpurge.o zgetline.o mbscmp.o uconvert.o ufuncs.o casemod.o \
input_avail.o mbscasecmp.o fnxform.o unicode.o shmbchar.o \
input_avail.o mbscasecmp.o fnxform.o unicode.o shmbchar.o strvis.o \
utf8.o random.o gettimeofday.o timers.o wcsnwidth.o ${LIBOBJS}
SUPPORT = Makefile
@@ -198,6 +198,7 @@ strtoul.o: strtoul.c
strtoull.o: strtoull.c
strtoumax.o: strtoumax.c
strtrans.o: strtrans.c
strvis.o: strvis.c
timers.o: timers.c
times.o: times.c
timeval.o: timeval.c
@@ -279,6 +280,7 @@ strtoul.o: ${BUILD_DIR}/config.h
strtoull.o: ${BUILD_DIR}/config.h
strtoumax.o: ${BUILD_DIR}/config.h
strtrans.o: ${BUILD_DIR}/config.h
strvis.o: ${BUILD_DIR}/config.h
timers.o: ${BUILD_DIR}/config.h
times.o: ${BUILD_DIR}/config.h
timeval.o: ${BUILD_DIR}/config.h
@@ -512,6 +514,11 @@ strtrans.o: ${BUILD_DIR}/pathnames.h ${topdir}/externs.h
strtrans.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
#strtrans.o: ${BUILD_DIR}/version.h
strvis.o: ${topdir}/bashansi.h
strvis.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/chartypes.h
strvis.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
strvis.o: ${topdir}/bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h
times.o: ${BASHINCDIR}/systimes.h
times.o: ${BASHINCDIR}/posixtime.h
+3 -2
View File
@@ -313,10 +313,11 @@ sh_backslash_quote (string, table, flags)
#if defined (PROMPT_STRING_DECODE) || defined (TRANSLATABLE_STRINGS)
/* Quote characters that get special treatment when in double quotes in STRING
using backslashes. Return a new string. */
using backslashes. FLAGS is reserved for future use. Return a new string. */
char *
sh_backslash_quote_for_double_quotes (string)
sh_backslash_quote_for_double_quotes (string, flags)
char *string;
int flags;
{
unsigned char c;
char *result, *r, *s, *send;
-1
View File
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
+148
View File
@@ -0,0 +1,148 @@
/* strvis.c - make unsafe graphical characters in a string visible. */
/* Copyright (C) 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash 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.
Bash 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 Bash. If not, see <http://www.gnu.org/licenses/>.
*/
/* This is a stripped-down version suitable for the shell's use. */
#include <config.h>
#include <unistd.h>
#include "bashansi.h"
#include <stdio.h>
#include "chartypes.h"
#include "bashintl.h"
#include "shmbutil.h"
#define SAFECHAR(c) ((c) == ' ' || (c) == '\t')
#ifndef RUBOUT
#define RUBOUT 0x7f
#endif
#ifndef CTRL_CHAR
#define CTRL_CHAR(c) ((c) < 0x20)
#endif
#ifndef META_CHAR
#define META_CHAR(c) ((c) > 0x7f && (c) <= UCHAR_MAX)
#endif
#ifndef UNCTRL
#define UNCTRL(c) (TOUPPER ((c) | 0x40))
#endif
#ifndef UNMETA
#define UNMETA(c) ((c) & 0x7f)
#endif
int
sh_charvis (s, sindp, slen, ret, rindp)
const char *s;
size_t *sindp;
size_t slen;
char *ret;
size_t *rindp;
{
unsigned char c;
size_t si, ri;
const char *send;
DECLARE_MBSTATE;
si = *sindp;
ri = *rindp;
c = s[*sindp];
send = (locale_mb_cur_max > 1) ? s + slen : 0;
if (SAFECHAR (c))
{
ret[ri++] = c;
si++;
}
else if (c == RUBOUT)
{
ret[ri++] = '^';
ret[ri++] = '?';
si++;
}
else if (CTRL_CHAR (c))
{
ret[ri++] = '^';
ret[ri++] = UNCTRL (c);
si++;
}
else if (locale_utf8locale && (c & 0x80))
COPY_CHAR_I (ret, ri, s, send, si);
else if (locale_mb_cur_max > 1 && is_basic (c) == 0)
COPY_CHAR_I (ret, ri, s, send, si);
else if (META_CHAR (c))
{
ret[ri++] = 'M';
ret[ri++] = '-';
ret[ri++] = UNMETA (c);
si++;
}
else
ret[ri++] = s[si++];
*sindp = si;
*rindp = ri;
return si;
}
/* Return a new string with `unsafe' non-graphical characters in S rendered
in a visible way. */
char *
sh_strvis (string)
const char *string;
{
size_t slen, sind;
char *ret;
size_t retind, retsize;
unsigned char c;
DECLARE_MBSTATE;
if (string == 0)
return 0;
if (*string == '\0')
{
if ((ret = (char *)malloc (1)) == 0)
return 0;
ret[0] = '\0';
return ret;
}
slen = strlen (string);
retsize = 3 * slen + 1;
ret = (char *)malloc (retsize);
if (ret == 0)
return 0;
retind = 0;
sind = 0;
while (string[sind])
sind = sh_charvis (string, &sind, slen, ret, &retind);
ret[retind] = '\0';
return ret;
}
+10 -12
View File
@@ -1,7 +1,7 @@
/* make_cmd.c -- Functions for making instances of the various
parser constructs. */
/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -575,9 +575,16 @@ make_here_document (temp, lineno)
full_line = document = (char *)NULL;
document_index = document_size = 0;
delim_unquoted = (temp->redirectee.filename->flags & W_QUOTED) == 0;
/* Quote removal is the only expansion performed on the delimiter
for here documents, making it an extremely special case. */
redir_word = string_quote_removal (temp->redirectee.filename->word, 0);
/* "If any part of word is quoted, the delimiter shall be formed by
performing quote removal on word." */
if (delim_unquoted == 0)
redir_word = string_quote_removal (temp->redirectee.filename->word, 0);
else
redir_word = savestring (temp->redirectee.filename->word);
/* redirection_expand will return NULL if the expansion results in
multiple words or no words. Check for that here, and just abort
@@ -604,7 +611,6 @@ make_here_document (temp, lineno)
/* If the here-document delimiter was quoted, the lines should
be read verbatim from the input. If it was not quoted, we
need to perform backslash-quoted newline removal. */
delim_unquoted = (temp->redirectee.filename->flags & W_QUOTED) == 0;
while (full_line = read_secondary_line (delim_unquoted))
{
register char *line;
@@ -632,10 +638,7 @@ make_here_document (temp, lineno)
}
if (*line == 0)
{
free (full_line);
continue;
}
continue;
if (STREQN (line, redir_word, redir_len) && line[redir_len] == '\n')
break;
@@ -644,7 +647,6 @@ make_here_document (temp, lineno)
if (STREQN (line, redir_word, redir_len) && (parser_state & PST_EOFTOKEN) && shell_eof_token && strchr (line+redir_len, shell_eof_token))
{
shell_ungets (line + redir_len);
free (full_line);
full_line = 0;
break;
}
@@ -660,15 +662,11 @@ make_here_document (temp, lineno)
being an empty string before the call to strlen. */
FASTCOPY (line, document + document_index, len);
document_index += len;
free (full_line);
}
if (full_line == 0)
internal_warning (_("here-document at line %d delimited by end-of-file (wanted `%s')"), lineno, redir_word);
FREE (full_line);
document_done:
if (document)
document[document_index] = '\0';
+7 -2
View File
@@ -3,7 +3,7 @@
/* This file works under BSD, System V, minix, and Posix systems. It does
not implement job control. */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -707,18 +707,20 @@ wait_for_single_pid (pid, flags)
/* Wait for all of the shell's children to exit. Called by the `wait'
builtin. */
void
int
wait_for_background_pids (ps)
struct procstat *ps;
{
pid_t got_pid;
WAIT status;
int njobs;
/* If we aren't using job control, we let the kernel take care of the
bookkeeping for us. wait () will return -1 and set errno to ECHILD
when there are no more unwaited-for child processes on both
4.2 BSD-based and System V-based systems. */
njobs = 0;
siginterrupt (SIGINT, 1);
/* Wait for ECHILD */
@@ -726,6 +728,7 @@ wait_for_background_pids (ps)
while ((got_pid = WAITPID (-1, &status, 0)) != -1)
{
waiting_for_child = 0;
njobs++;
set_pid_status (got_pid, status);
if (ps)
{
@@ -749,6 +752,8 @@ wait_for_background_pids (ps)
mark_dead_jobs_as_notified (1);
cleanup_dead_jobs ();
return njobs;
}
void
+69 -44
View File
@@ -1,6 +1,6 @@
/* parse.y - Yacc grammar for bash. */
/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -2136,14 +2136,12 @@ read_a_line (remove_quoted_newline)
the secondary prompt. This is used to read the lines of a here
document. REMOVE_QUOTED_NEWLINE is non-zero if we should remove
newlines quoted with backslashes while reading the line. It is
non-zero unless the delimiter of the here document was quoted.
If it is zero, we don't perform $'...' and $"..." expansion because
we treat the lines as if they are between double quotes. */
non-zero unless the delimiter of the here document was quoted. */
char *
read_secondary_line (remove_quoted_newline)
int remove_quoted_newline;
{
char *ret, *t;
char *ret;
int n, c;
prompt_string_pointer = &ps2_prompt;
@@ -2163,23 +2161,7 @@ read_secondary_line (remove_quoted_newline)
maybe_add_history (ret);
}
#endif /* HISTORY */
if (ret == 0)
return ret;
if (remove_quoted_newline == 0)
return (savestring (ret));
t = ret;
while (t = strchr (t, '$'))
{
if (t[1] == '\'' || t[1] == '"')
break;
else
t++;
}
if (t == 0)
return (savestring (ret));
t = expand_string_dollar_quote (ret, 1);
return t;
return ret;
}
/* **************************************************************** */
@@ -3417,7 +3399,7 @@ read_token (command)
character = '\n'; /* this will take the next if statement and return. */
}
if (character == '\n')
if MBTEST(character == '\n')
{
/* If we're about to return an unquoted newline, we can go and collect
the text of any pending here document. */
@@ -3437,7 +3419,7 @@ read_token (command)
goto tokword;
/* Shell meta-characters. */
if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
if MBTEST(shellmeta (character))
{
#if defined (ALIAS)
/* Turn off alias tokenization iff this character sequence would
@@ -3458,7 +3440,7 @@ read_token (command)
else
peek_char = shell_getc (1);
if (character == peek_char)
if MBTEST(character == peek_char)
{
switch (character)
{
@@ -3687,7 +3669,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
}
/* Possible reprompting. */
if (ch == '\n' && SHOULD_PROMPT ())
if MBTEST(ch == '\n' && SHOULD_PROMPT ())
prompt_again (0);
/* Don't bother counting parens or doing anything else if in a comment
@@ -3698,7 +3680,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64);
ret[retind++] = ch;
if (ch == '\n')
if MBTEST(ch == '\n')
tflags &= ~LEX_INCOMMENT;
continue;
@@ -3714,7 +3696,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
{
tflags &= ~LEX_PASSNEXT;
/* XXX - PST_NOEXPAND? */
if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
if MBTEST(qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
{
if (retind > 0)
retind--; /* swallow previously-added backslash */
@@ -3823,7 +3805,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
pop_delimiter (dstack);
CHECK_NESTRET_ERROR ();
if MBTEST((tflags & LEX_WASDOL) && ch == '\'' && (extended_quote || (rflags & P_DQUOTE) == 0))
if MBTEST((tflags & LEX_WASDOL) && ch == '\'' && (extended_quote || (rflags & P_DQUOTE) == 0 || dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_QUOTE2))
{
/* Translate $'...' here. */
/* PST_NOEXPAND */
@@ -3835,12 +3817,22 @@ parse_matched_pair (qc, open, close, lenp, flags)
make sure we single-quote the results of the ansi
expansion because quote removal should remove them later */
/* FLAG POSIX INTERP 221 */
if ((shell_compatibility_level > 42) && (rflags & P_DQUOTE) && (dolbrace_state == DOLBRACE_QUOTE2) && (flags & P_DOLBRACE))
if ((shell_compatibility_level > 42) && (rflags & P_DQUOTE) && (dolbrace_state == DOLBRACE_QUOTE2 || dolbrace_state == DOLBRACE_QUOTE) && (flags & P_DOLBRACE))
{
nestret = sh_single_quote (ttrans);
free (ttrans);
nestlen = strlen (nestret);
}
#if 0 /* TAG:bash-5.3 */
/* This single-quotes PARAM in ${PARAM OP WORD} when PARAM
contains a $'...' even when extended_quote is set. */
else if ((rflags & P_DQUOTE) && (dolbrace_state == DOLBRACE_PARAM) && (flags & P_DOLBRACE))
{
nestret = sh_single_quote (ttrans);
free (ttrans);
nestlen = strlen (nestret);
}
#endif
else if ((rflags & P_DQUOTE) == 0)
{
nestret = sh_single_quote (ttrans);
@@ -3875,7 +3867,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
nestret = sh_single_quote (ttrans);
else
/* single quotes aren't special, use backslash instead */
nestret = sh_backslash_quote_for_double_quotes (ttrans);
nestret = sh_backslash_quote_for_double_quotes (ttrans, 0);
}
else
nestret = sh_mkdoublequoted (ttrans, ttranslen, 0);
@@ -4069,6 +4061,10 @@ parse_comsub (qc, open, close, lenp, flags)
save_parser_state (&ps);
pushed_string_list = (STRING_SAVER *)NULL;
/* State flags we don't want to persist into command substitutions. */
parser_state &= ~(PST_REGEXP|PST_EXTPAT|PST_CONDCMD|PST_CONDEXPR);
/* State flags we want to set for this run through the parser. */
parser_state |= PST_CMDSUBST|PST_EOFTOKEN|PST_NOEXPAND;
shell_eof_token = close;
@@ -4079,6 +4075,13 @@ parse_comsub (qc, open, close, lenp, flags)
need_here_doc = 0;
esacs_needed_count = expecting_in_token = 0;
/* We want to expand aliases on this pass if we're in posix mode, since the
standard says you have to take aliases into account when looking for the
terminating right paren. Otherwise, we defer until execution time for
backwards compatibility. */
if (expand_aliases)
expand_aliases = posixly_correct != 0;
current_token = '\n'; /* XXX */
token_to_read = DOLPAREN; /* let's trick the parser */
@@ -4183,6 +4186,13 @@ xparse_dolparen (base, string, indp, flags)
if (flags & SX_COMPLETE)
parser_state |= PST_NOERROR;
/* Don't expand aliases on this pass at all. Either parse_comsub() does it
at parse time, in which case this string already has aliases expanded,
or command_substitute() does it in the child process executing the
command substitution and we want to defer it completely until then. The
old value will be restored by restore_parser_state(). */
expand_aliases = 0;
token_to_read = DOLPAREN; /* let's trick the parser */
nc = parse_string (string, "command substitution", sflags, (COMMAND **)NULL, &ep);
@@ -4295,6 +4305,8 @@ parse_string_to_command (string, flags)
if (flags & SX_COMPLETE)
parser_state |= PST_NOERROR;
expand_aliases = 0;
cmd = 0;
nc = parse_string (string, "command substitution", sflags, &cmd, &ep);
@@ -4799,7 +4811,7 @@ read_token_word (character)
/* Backslash-newline is ignored in all cases except
when quoted with single quotes. */
if (peek_char == '\n')
if MBTEST(peek_char == '\n')
{
character = '\n';
goto next_character;
@@ -4809,7 +4821,7 @@ read_token_word (character)
shell_ungetc (peek_char);
/* If the next character is to be quoted, note it now. */
if (cd == 0 || cd == '`' ||
if MBTEST(cd == 0 || cd == '`' ||
(cd == '"' && peek_char >= 0 && (sh_syntaxtab[peek_char] & CBSDQUOTE)))
pass_next_character++;
@@ -4894,7 +4906,7 @@ read_token_word (character)
/* If the delimiter character is not single quote, parse some of
the shell expansions that must be read as a single word. */
if (shellexp (character))
if MBTEST(shellexp (character))
{
peek_char = shell_getc (1);
/* $(...), <(...), >(...), $((...)), ${...}, and $[...] constructs */
@@ -5074,7 +5086,7 @@ read_token_word (character)
}
got_character:
if (character == CTLESC || character == CTLNUL)
if MBTEST(character == CTLESC || character == CTLNUL)
{
RESIZE_MALLOCED_BUFFER (token, token_index, 2, token_buffer_size,
TOKEN_DEFAULT_GROW_SIZE);
@@ -5188,7 +5200,7 @@ got_token:
yylval.word = the_word;
/* should we check that quoted == 0 as well? */
if (token[0] == '{' && token[token_index-1] == '}' &&
if MBTEST(token[0] == '{' && token[token_index-1] == '}' &&
(character == '<' || character == '>'))
{
/* can use token; already copied to the_word */
@@ -5433,8 +5445,11 @@ history_delimiting_chars (line)
return (" ");
}
/* Assume that by this point we are reading lines in a multi-line command.
If we have multiple consecutive blank lines we want to return only one
semicolon. */
if (line_isblank (line))
return ("");
return (current_command_line_count > 1 && last_read_token == '\n' && token_before_that != '\n') ? "; " : "";
return ("; ");
}
@@ -5574,7 +5589,7 @@ decode_prompt_string (string)
int last_exit_value, last_comsub_pid;
#if defined (PROMPT_STRING_DECODE)
size_t result_size;
int result_index;
size_t result_index;
int c, n, i;
char *temp, *t_host, octal_string[4];
struct tm *tm;
@@ -5711,7 +5726,7 @@ decode_prompt_string (string)
/* Make sure that expand_prompt_string is called with a
second argument of Q_DOUBLE_QUOTES if we use this
function here. */
temp = sh_backslash_quote_for_double_quotes (timebuf);
temp = sh_backslash_quote_for_double_quotes (timebuf, 0);
else
temp = savestring (timebuf);
goto add_string;
@@ -5727,9 +5742,14 @@ decode_prompt_string (string)
temp = base_pathname (shell_name);
/* Try to quote anything the user can set in the file system */
if (promptvars || posixly_correct)
temp = sh_backslash_quote_for_double_quotes (temp);
{
char *t;
t = sh_strvis (temp);
temp = sh_backslash_quote_for_double_quotes (t, 0);
free (t);
}
else
temp = savestring (temp);
temp = sh_strvis (temp);
goto add_string;
case 'v':
@@ -5804,9 +5824,14 @@ decode_prompt_string (string)
/* Make sure that expand_prompt_string is called with a
second argument of Q_DOUBLE_QUOTES if we use this
function here. */
temp = sh_backslash_quote_for_double_quotes (t_string);
{
char *t;
t = sh_strvis (t_string);
temp = sh_backslash_quote_for_double_quotes (t, 0);
free (t);
}
else
temp = savestring (t_string);
temp = sh_strvis (t_string);
goto add_string;
}
@@ -5826,7 +5851,7 @@ decode_prompt_string (string)
/* Make sure that expand_prompt_string is called with a
second argument of Q_DOUBLE_QUOTES if we use this
function here. */
temp = sh_backslash_quote_for_double_quotes (t_host);
temp = sh_backslash_quote_for_double_quotes (t_host, 0);
else
temp = savestring (t_host);
free (t_host);
-191
View File
@@ -1,191 +0,0 @@
/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
Inc.
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 <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
YYEMPTY = -2,
YYEOF = 0, /* "end of file" */
YYerror = 256, /* error */
YYUNDEF = 257, /* "invalid token" */
IF = 258, /* IF */
THEN = 259, /* THEN */
ELSE = 260, /* ELSE */
ELIF = 261, /* ELIF */
FI = 262, /* FI */
CASE = 263, /* CASE */
ESAC = 264, /* ESAC */
FOR = 265, /* FOR */
SELECT = 266, /* SELECT */
WHILE = 267, /* WHILE */
UNTIL = 268, /* UNTIL */
DO = 269, /* DO */
DONE = 270, /* DONE */
FUNCTION = 271, /* FUNCTION */
COPROC = 272, /* COPROC */
COND_START = 273, /* COND_START */
COND_END = 274, /* COND_END */
COND_ERROR = 275, /* COND_ERROR */
IN = 276, /* IN */
BANG = 277, /* BANG */
TIME = 278, /* TIME */
TIMEOPT = 279, /* TIMEOPT */
TIMEIGN = 280, /* TIMEIGN */
WORD = 281, /* WORD */
ASSIGNMENT_WORD = 282, /* ASSIGNMENT_WORD */
REDIR_WORD = 283, /* REDIR_WORD */
NUMBER = 284, /* NUMBER */
ARITH_CMD = 285, /* ARITH_CMD */
ARITH_FOR_EXPRS = 286, /* ARITH_FOR_EXPRS */
COND_CMD = 287, /* COND_CMD */
AND_AND = 288, /* AND_AND */
OR_OR = 289, /* OR_OR */
GREATER_GREATER = 290, /* GREATER_GREATER */
LESS_LESS = 291, /* LESS_LESS */
LESS_AND = 292, /* LESS_AND */
LESS_LESS_LESS = 293, /* LESS_LESS_LESS */
GREATER_AND = 294, /* GREATER_AND */
SEMI_SEMI = 295, /* SEMI_SEMI */
SEMI_AND = 296, /* SEMI_AND */
SEMI_SEMI_AND = 297, /* SEMI_SEMI_AND */
LESS_LESS_MINUS = 298, /* LESS_LESS_MINUS */
AND_GREATER = 299, /* AND_GREATER */
AND_GREATER_GREATER = 300, /* AND_GREATER_GREATER */
LESS_GREATER = 301, /* LESS_GREATER */
GREATER_BAR = 302, /* GREATER_BAR */
BAR_AND = 303, /* BAR_AND */
DOLPAREN = 304, /* DOLPAREN */
yacc_EOF = 305 /* yacc_EOF */
};
typedef enum yytokentype yytoken_kind_t;
#endif
/* Token kinds. */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define IF 258
#define THEN 259
#define ELSE 260
#define ELIF 261
#define FI 262
#define CASE 263
#define ESAC 264
#define FOR 265
#define SELECT 266
#define WHILE 267
#define UNTIL 268
#define DO 269
#define DONE 270
#define FUNCTION 271
#define COPROC 272
#define COND_START 273
#define COND_END 274
#define COND_ERROR 275
#define IN 276
#define BANG 277
#define TIME 278
#define TIMEOPT 279
#define TIMEIGN 280
#define WORD 281
#define ASSIGNMENT_WORD 282
#define REDIR_WORD 283
#define NUMBER 284
#define ARITH_CMD 285
#define ARITH_FOR_EXPRS 286
#define COND_CMD 287
#define AND_AND 288
#define OR_OR 289
#define GREATER_GREATER 290
#define LESS_LESS 291
#define LESS_AND 292
#define LESS_LESS_LESS 293
#define GREATER_AND 294
#define SEMI_SEMI 295
#define SEMI_AND 296
#define SEMI_SEMI_AND 297
#define LESS_LESS_MINUS 298
#define AND_GREATER 299
#define AND_GREATER_GREATER 300
#define LESS_GREATER 301
#define GREATER_BAR 302
#define BAR_AND 303
#define DOLPAREN 304
#define yacc_EOF 305
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 328 "/usr/local/src/bash/bash-20220112/parse.y"
WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */
WORD_LIST *word_list;
COMMAND *command;
REDIRECT *redirect;
ELEMENT element;
PATTERN_LIST *pattern;
#line 177 "y.tab.h"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */
+1 -1
View File
@@ -30,7 +30,7 @@
#define PST_ALEXPNEXT 0x000002 /* expand next word for aliases */
#define PST_ALLOWOPNBRC 0x000004 /* allow open brace for function def */
#define PST_NEEDCLOSBRC 0x000008 /* need close brace */
#define PST_DBLPAREN 0x000010 /* double-paren parsing */
#define PST_DBLPAREN 0x000010 /* double-paren parsing - unused */
#define PST_SUBSHELL 0x000020 /* ( ... ) subshell */
#define PST_CMDSUBST 0x000040 /* $( ... ) command substitution */
#define PST_CASESTMT 0x000080 /* parsing a case statement */
+1
View File
@@ -171,6 +171,7 @@ ere_char (c)
return (0);
}
/* This is only used to determine whether to backslash-quote a character. */
int
glob_char_p (s)
const char *s;
BIN
View File
Binary file not shown.
+41 -41
View File
@@ -3,13 +3,13 @@
# This file is distributed under the same license as the bash package.
#
# Tomislav Krznar <tomislav.krznar@gmail.com>, 2012, 2013.
# Božidar Putanec <bozidarp@yahoo.com>, 2018, 2019, 2020, 2021.
# Božidar Putanec <bozidarp@yahoo.com>, 2018, 2019, 2020, 2021, 2022.
msgid ""
msgstr ""
"Project-Id-Version: bash 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-28 12:51-0500\n"
"PO-Revision-Date: 2021-01-02 13:56-0800\n"
"PO-Revision-Date: 2022-03-30 11:48-0700\n"
"Last-Translator: Božidar Putanec <bozidarp@yahoo.com>\n"
"Language-Team: Croatian <lokalizacija@linux.hr>\n"
"Language: hr\n"
@@ -267,7 +267,7 @@ msgstr "%s je izvan raspona"
#: builtins/common.c:284
#, c-format
msgid "%s: no such job"
msgstr "%s: nema takvoga posla"
msgstr "%s: nema takvog posla"
#: builtins/common.c:292
#, c-format
@@ -489,7 +489,7 @@ msgstr "nijedna naredba nije nađena"
#: builtins/fc.def:363 builtins/fc.def:368 builtins/fc.def:407
#: builtins/fc.def:412
msgid "history specification"
msgstr "prikaz povijesti"
msgstr "specifikacija povijesti"
#: builtins/fc.def:444
#, c-format
@@ -782,9 +782,9 @@ msgstr ""
"\n"
" Argumenti:\n"
" +N Zarotira stȏg tako, da N-ti direktorij u stȏgu (brojeći od nule s\n"
" lijeve strane popisa prikazanoga s „dirs“) postane novi vrh stȏga.\n"
" lijeve strane popisa pokazanog s „dirs“) postane novi vrh stȏga.\n"
" -N Zarotira stȏg tako, da N-ti direktorij u stȏgu (brojeći od nule s\n"
" desne strane popisa prikazanoga s „dirs“) postane novi vrh stȏga.\n"
" desne strane popisa pokazanog s „dirs“) postane novi vrh stȏga.\n"
" DIREKTORIJ Doda DIREKTORIJ na vrh stȏga direktorija i\n"
" učini ga novim trenutnim radnim direktorijem.\n"
"\n"
@@ -820,10 +820,10 @@ msgstr ""
"\n"
" Argumenti:\n"
" +N Ukloni da N-ti direktorij iz stȏga brojeći od nule s lijeve\n"
" strane popisa prikazanoga s „dirs“. Na primjer: „popd +0“\n"
" strane popisa pokazanog s „dirs“. Na primjer: „popd +0“\n"
" ukloni prvi, a „popd +1“ ukloni drugi direktorij.\n"
" +N Ukloni da N-ti direktorij iz stȏga brojeći od nule s desne\n"
" strane popisa prikazanoga s „dirs“. Na primjer.: „popd -0“\n"
" strane popisa pokazanog s „dirs“. Na primjer.: „popd -0“\n"
" ukloni zadnji, a „popd -1“ ukloni predzadnji direktorij.\n"
"\n"
" Naredba „dirs“ prikaže trenutni sadržaj stȏga direktorija."
@@ -1827,7 +1827,7 @@ msgstr "Loš sustavski poziv"
#: siglist.c:102
msgid "Broken pipe"
msgstr "Slomljena cijev"
msgstr "Potrgana cijev"
#: siglist.c:106
msgid "Alarm clock"
@@ -1973,7 +1973,7 @@ msgstr "nije moguće duplicirati imenovanu cijev %s kao deskriptor datoteke %d"
#: subst.c:6213
msgid "command substitution: ignored null byte in input"
msgstr "nevaljana supstitucija: ignorira se prazni (nula) bajt na ulazu"
msgstr "nevaljana supstitucija: zanemaren prazni (nula) bajt u ulazu"
#: subst.c:6353
msgid "cannot make pipe for command substitution"
@@ -2796,10 +2796,10 @@ msgstr ""
"\n"
" Opcije:\n"
" -L slijedi simboličke veze; simboličke veze u DIREKTORIJU razriješi\n"
" nakon obrade zapisa „..“\n"
" nakon obrade instance „..“\n"
" -P rabi fizičku strukturu direktorija umjesto da slijedi simboličke\n"
" veze; simboličke veze u DIREKTORIJU razriješi prije obrade\n"
" zapisa „..“\n"
" instance „..“\n"
" -e ako je dana s opcijom „-P“, i trenutni radni direktorij nije\n"
" moguće uspješno odrediti nakon uspješne promjene direktorija,\n"
" „cd“ završi s kȏdom različitim od 0.\n"
@@ -2948,7 +2948,7 @@ msgstr ""
" -f prikaže samo definirane funkcije (ne prikaže varijable)\n"
" -F prikaže samo imena funkcija bez definicija\n"
" -g stvori globalne varijable samo za upotrebu u funkciji ljuske;\n"
" inače se ignoriraju\n"
" inače su zanemarene\n"
" -I ako stvori lokalnu varijablu, neka naslijedi atribute i vrijednost\n"
" varijable s istim imenom u prethodnom opsegu\n"
" -p prikaže atribute i vrijednost za svako dano IME\n"
@@ -3065,7 +3065,7 @@ msgstr ""
" \\E znak za escape (ESC)\n"
" \\f nova stranica (znak za FF, form feed)\n"
" \\n novi redak (znak za LF, line feed)\n"
" \\r na početak novoga retka (Enter, znak za CR, carriage return)\n"
" \\r na početak novog retka (Enter, znak za CR, carriage return)\n"
" \\t horizontalni tabulator\n"
" \\v vertikalni tabulator\n"
" \\\\ backslash (\\)\n"
@@ -3139,7 +3139,7 @@ msgstr ""
" -f učita ugrađenu naredbu IME iz dijeljenog objekta DATOTEKA\n"
" -d ukloni ugrađenu naredbu učitanu s „-f“\n"
"\n"
" Bez opcija, omogućena su sva navedena IMENA. Bez imena prikazane su\n"
" Bez opcija, omogućena su sva navedena IMENA. Bez imena pokazane su\n"
" omogućene naredbe (ili s „-n“ onemogućene).\n"
"\n"
" Primjer: da koristite binarnu datoteku „test“ koja se nalazi na stazi\n"
@@ -3327,7 +3327,7 @@ msgid ""
msgstr ""
"Prikaže ili izvrši naredbe iz popisa povijesti.\n"
"\n"
" Koristi se za prikazivanje dosadašnjih, za uređivanje ili za ponovno\n"
" Koristi se za pokazivanje dosadašnjih, za uređivanje ili za ponovno\n"
" pokretanje naredbi. PRVA i ZADNJA mogu biti brojevi koji specificiraju\n"
" raspon ili PRVA može biti string s koji specificira najnoviju naredbu\n"
" koja započinje s tim slovima.\n"
@@ -3565,7 +3565,7 @@ msgstr ""
"\n"
" Ako je navedena opcija '-x', dana NAREDBA će se izvršiti tek nakon\n"
" zatvaranja svih navedenih poslova u ARGUMENTIMA (tj. njihov ID procesa je\n"
" zamijenjen s ID-om njima nadređenoga procesa).\n"
" zamijenjen s ID-om njima nadređenog procesa).\n"
"\n"
" Završi s uspjehom osim ako je dana nevaljana opcija ili se dogodila greška.\n"
" Ako je dana opcija -x, završi sa izlaznim kȏdom NAREDBE."
@@ -3772,9 +3772,9 @@ msgid ""
" (in which case it's greater than 128), a variable assignment error occurs,\n"
" or an invalid file descriptor is supplied as the argument to -u."
msgstr ""
"Pročita redak iz standardnoga ulaza i razdijeli ga na polja.\n"
"Pročita redak iz standardnog ulaza i razdijeli ga na polja.\n"
"\n"
" Pročita jedan redak iz standardnoga ulaza (ili navedenog deskriptora\n"
" Pročita jedan redak iz standardnog ulaza (ili navedenog deskriptora\n"
" datoteke FD ako je dana opcija „-u“) i dodijeli prvu riječ prvom IMENU,\n"
" drugu riječ drugom IMENU, i tako dalje; preostale riječi dodijeli zadnjem\n"
" IMENU. Samo se znakovi sadržani u varijabli $IFS prepoznaju kao MEĐA\n"
@@ -3801,7 +3801,7 @@ msgstr ""
" samo ako je ulaz dostupni na specificiranom deskriptoru\n"
" datoteke Završi s uspjehom\n"
"\n"
" -u FD čita iz deskriptora datoteke FD umjesto iz standardnoga ulaza\n"
" -u FD čita iz deskriptora datoteke FD umjesto iz standardnog ulaza\n"
"\n"
" Završi s uspjehom osim ako ne naiđe na konac datoteke (EOF) ili je\n"
" isteklo vrijeme čekanja ili se dogodila greška pri dodjeli ili je\n"
@@ -3962,7 +3962,7 @@ msgstr ""
" hashall == -h\n"
" histexpand == -H\n"
" history omogući naredbu „history“\n"
" ignoreeof ignorira Ctrl-D; ne završi (ne iziđe iz) ljusku na EOF\n"
" ignoreeof zanemari Ctrl-D; ne završi (ne iziđe iz) ljusku na EOF\n"
" interactive-comments dopusti komentiranje u interaktivnim naredbama\n"
" keyword == -k\n"
" monitor == -m\n"
@@ -4081,8 +4081,8 @@ msgstr ""
" VRIJEDNOST, prvo mu dodijeli VRIJEDNOST, a zatim ga označi nepromjenjivim.\n"
"\n"
" Opcije:\n"
" -a svako IME se odnosi na varijable indeksiranoga polja\n"
" -A svako IME se odnosi na varijable asocijativnoga polja\n"
" -a svako IME se odnosi na varijable indeksiranog polja\n"
" -A svako IME se odnosi na varijable asocijativnog polja\n"
" -f svako IME se odnosi na funkcije ljuske\n"
" -p prikaže popis svih nepromjenjivih varijabli ili funkcija\n"
" ovisno o opciji „-f“ (je li ili nije dana).\n"
@@ -4281,9 +4281,9 @@ msgstr ""
" STRING1 = STRING2 istina ako su stringovi jednaki\n"
" STRING1 != STRING2 istina ako stringovi nisu jednaki\n"
" STRING1 < STRING2 istina ako se leksikografski prvi string\n"
" razvrsta ispred drugoga\n"
" razvrsta ispred drugog\n"
" STRING1 > STRING2 istina ako se leksikografski prvi string\n"
" razvrsta iza drugoga\n"
" razvrsta iza drugog\n"
"\n"
" Ostali operatori:\n"
" -o OPCIJA istina ako je ova OPCIJA ljuske omogućena\n"
@@ -4372,7 +4372,7 @@ msgstr ""
" specificiranih signala (SIGNAL_SPEC). Ako nema ARGUMENTA (i dan je samo\n"
" jedan signal) ili ARGUMENT je „-“, specificirani signal zadobije svoju\n"
" originalnu vrijednost (koju je imao na startu ove ljuske). Ako je ARGUMENT\n"
" prazni string, ljuska i njezini potomci ignoriraju svaki SIGNAL_SPEC.\n"
" prazni string, ljuska i njezini potomci zanemare svaki SIGNAL_SPEC.\n"
"\n"
" Ako je SIGNAL_SPEC 0 ili EXIT, ARGUMENT se izvrši kad zatvorite\n"
" (exit) ljusku. Ako je SIGNAL_SPEC DEBUG, ARGUMENT se izvrši prije\n"
@@ -4648,9 +4648,9 @@ msgid ""
" Exit Status:\n"
" Returns the status of the last command executed."
msgstr ""
"Izvrši naredbe za svakoga člana u popisu.\n"
"Izvrši naredbe za svakog člana u popisu.\n"
"\n"
" Petlja „for“ izvrši sekvenciju naredbi za svakoga člana u popisu stavki.\n"
" Petlja „for“ izvrši sekvenciju naredbi za svakog člana u popisu stavki.\n"
" Ako nema operanda „in RIJEČIMA...; podrazumijeva se operand\n"
" „in \"$@\"“. Svakom elementu u RIJEČIMA, IME se postavi na taj element\n"
" i NAREDBE se izvrše.\n"
@@ -4708,8 +4708,8 @@ msgstr ""
" Proširenjem RIJEČI, „select“ generira i prikaže izbornik na standardnom\n"
" izlazu za greške s brojem ispred svake riječi. Ako operand „u RIJEČIMA“\n"
" nije naveden, podrazumijeva se operand „in \"$@\"“.\n"
" Nakon izbornika prikaže se PS3 prompt i redak se čita iz standardnoga\n"
" ulaza; ako se redak sastoji od broja koji odgovara jednoj od prikazanih\n"
" Nakon izbornika prikaže se PS3 prompt i redak se čita iz standardnog\n"
" ulaza; ako se redak sastoji od broja koji odgovara jednoj od pokazanih\n"
" riječi, onda varijabla IME dobije vrijednost te riječi; ako je redak\n"
" prazan, RIJEČI i prompt se ponovno prikažu; ako se pročita EOF (Ctrl-D)\n"
" „select“ naredba završi. Bilo koja druga pročitana vrijednost učini da se\n"
@@ -4741,7 +4741,7 @@ msgstr ""
" korisnikom i CPU vrijeme potrošeno sustavom za izvršavanje naredbi.\n"
"\n"
" Izlazni format se može prilagoditi s varijablom okoline TIMEFORMAT.\n"
" Opcija „-p“ ignorira TIMEFORMAT i ispiše izlaz u prenosivom POSIX\n"
" Opcija „-p“ zanemari TIMEFORMAT i ispiše izlaz u prenosivom POSIX\n"
" formatu.\n"
"\n"
" Završi s izlaznim kȏdom CJEVOVODA."
@@ -5030,25 +5030,25 @@ msgstr ""
" kad argument od „cd“ (direktorij) nije u\n"
" trenutnom radnom direktoriju\n"
" GLOBIGNORE popis uzoraka koji opisuju imena datoteka koje\n"
" se ignoriraju prilikom ekspanzije imena staza\n"
" su zanemarene prilikom ekspanzije imena staza\n"
" HISTFILE ime datoteke koja sadrži povijest vaših naredbi\n"
" HISTFILESIZE maksimalni broj redaka datoteke s povijesti naredba\n"
" HISTIGNORE popis uzoraka koji opisuju naredbe koje ne treba zapisati\n"
" u datoteku koja sadrži povijest vaših naredbi\n"
" HISTSIZE maksimalni broj redaka koje trenutna ljuska može dosegnuti\n"
" HOME puni naziv staze do vašega osobnoga direktorija\n"
" HOME puni naziv staze do vašega vlastitog direktorija\n"
" HOSTNAME ime računala na kojem se izvršava „bash“\n"
" HOSTTYPE vrsta CPU-a na kojem se izvršava „bash“\n"
" IGNOREEOF broj ignoriranih Ctrl-D (EOF) prije zatvaranja ljuske\n"
" IGNOREEOF broj zanemarenih Ctrl-D (EOF) prije zatvaranja ljuske\n"
" MACHTYPE vrsta računala na kojem se izvršava „bash“\n"
" MAILCHECK kako često (u sekundama) „bash“ gleda ima li nove pošte\n"
" MAILPATH popis datoteka koje „bash“ provjeri za novu poštu\n"
" OSTYPE distribucija Unix-a no kojem se izvršava ovaj „bash“\n"
" PATH popis direktorija u kojima se traže naredbe\n"
" PROMPT_COMMAND naredba koja se izvrši prije ispisa primarnoga prompta\n"
" PROMPT_COMMAND naredba koja se izvrši prije ispisa primarnog prompta\n"
" PS1 string koji opisuje primarni prompt\n"
" PS2 string koji opisuje sekundarni prompt (zadano, „>“)\n"
" PWD puni naziv staze trenutnog radnoga direktorija\n"
" PWD puni naziv staze trenutnog radnog direktorija\n"
" SHELLOPTS popis svih omogućenih opcija ljuske\n"
" TERM naziv vrste trenutnog terminala\n"
" TIMEFORMAT pravilo za format ispisa „time“ statistika\n"
@@ -5111,9 +5111,9 @@ msgstr ""
" DIREKTORIJ Doda DIREKTORIJ na vrh stȏga direktorija i\n"
" učini ga novim trenutnim radnim direktorijem.\n"
" +N Zarotira stȏg tako, da N-ti direktorij u stȏgu (brojeći od nule s\n"
" lijeve strane popisa prikazanoga s „dirs“) postane novi vrh stȏga.\n"
" lijeve strane popisa pokazanog s „dirs“) postane novi vrh stȏga.\n"
" -N Zarotira stȏg tako, da N-ti direktorij u stȏgu (brojeći od nule s\n"
" desne strane popisa prikazanoga s „dirs“) postane novi vrh stȏga.\n"
" desne strane popisa pokazanog s „dirs“) postane novi vrh stȏga.\n"
"\n"
" Naredba „dirs“ prikaže trenutni sadržaj stȏga direktorija.\n"
"\n"
@@ -5158,10 +5158,10 @@ msgstr ""
"\n"
" Argumenti:\n"
" +N Ukloni da N-ti direktorij iz stȏga brojeći od nule s lijeve\n"
" strane popisa prikazanoga s „dirs“. Na primjer: „popd +0“\n"
" strane popisa pokazanog s „dirs“. Na primjer: „popd +0“\n"
" ukloni prvi, a „popd +1“ ukloni drugi direktorij.\n"
" +N Ukloni da N-ti direktorij iz stȏga brojeći od nule s desne\n"
" strane popisa prikazanoga s „dirs“. Na primjer.: „popd -0“\n"
" strane popisa pokazanog s „dirs“. Na primjer.: „popd -0“\n"
" ukloni zadnji, a „popd -1“ ukloni predzadnji direktorij.\n"
"\n"
" Naredba „dirs“ prikaže trenutni sadržaj stȏga direktorija.\n"
@@ -5470,7 +5470,7 @@ msgid ""
" Returns success unless an invalid option is given or ARRAY is readonly or\n"
" not an indexed array."
msgstr ""
"Pročitane retke iz standardnoga ulaza upiše u varijablu indeksirano polje.\n"
"Pročitane retke iz standardnog ulaza upiše u varijablu indeksirano polje.\n"
"\n"
" Pročitane retke iz standardnog ulaza (ili ako je navedena opcija -u, iz\n"
" deskriptora datoteke FD) upiše u indeksiranu varijablu POLJE. Ako argument\n"
BIN
View File
Binary file not shown.
+11 -11
View File
@@ -26,7 +26,7 @@ msgstr ""
"Project-Id-Version: bash 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-28 12:51-0500\n"
"PO-Revision-Date: 2022-01-12 18:01+0800\n"
"PO-Revision-Date: 2022-03-22 16:23+0800\n"
"Last-Translator: Wenbin Lv <wenbin816@gmail.com>\n"
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
"Language: zh_CN\n"
@@ -784,7 +784,7 @@ msgid ""
" \n"
" The `dirs' builtin displays the directory stack."
msgstr ""
"将目录添加到目录栈顶,或着旋转栈直到当前工作目录成为\n"
"将目录添加到目录栈顶,或者轮转栈直到当前工作目录成为\n"
" 新的栈顶。不带参数时,交换栈顶的两个目录。\n"
" \n"
" 选项:\n"
@@ -792,10 +792,10 @@ msgstr ""
" \t进行操作。\n"
" \n"
" 参数:\n"
" +N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中左起,\n"
" +N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中左起,\n"
" \t从零开始)移动到栈顶。\n"
" \n"
" -N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中右起,\n"
" -N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中右起,\n"
" \t从零开始)移动到栈顶。\n"
" \n"
" 目录\t将 <目录> 添加到栈顶,使其成为当前工作目录。\n"
@@ -1437,22 +1437,22 @@ msgstr "不支持网络操作"
#: locale.c:217
#, c-format
msgid "setlocale: LC_ALL: cannot change locale (%s)"
msgstr "setlocale: LC_ALL: 无法改变区域选项 (%s)"
msgstr "setlocale: LC_ALL: 无法改变区域设置 (%s)"
#: locale.c:219
#, c-format
msgid "setlocale: LC_ALL: cannot change locale (%s): %s"
msgstr "setlocale: LC_ALL: 无法改变区域选项 (%s)%s"
msgstr "setlocale: LC_ALL: 无法改变区域设置 (%s)%s"
#: locale.c:292
#, c-format
msgid "setlocale: %s: cannot change locale (%s)"
msgstr "setlocale: %s: 无法改变区域选项 (%s)"
msgstr "setlocale: %s: 无法改变区域设置 (%s)"
#: locale.c:294
#, c-format
msgid "setlocale: %s: cannot change locale (%s): %s"
msgstr "setlocale: %s: 无法改变区域选项 (%s)%s"
msgstr "setlocale: %s: 无法改变区域设置 (%s)%s"
#: mailcheck.c:439
msgid "You have mail in $_"
@@ -5061,7 +5061,7 @@ msgid ""
msgstr ""
"将目录添加到栈中。\n"
" \n"
" 将目录添加到目录栈顶,或着旋转栈直到当前工作目录成为\n"
" 将目录添加到目录栈顶,或者轮转栈直到当前工作目录成为\n"
" 新的栈顶。不带参数时,交换栈顶的两个目录。\n"
" \n"
" 选项:\n"
@@ -5069,10 +5069,10 @@ msgstr ""
" \t\t进行操作。\n"
" \n"
" 参数:\n"
" +N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中左起,\n"
" +N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中左起,\n"
" \t\t从零开始)移动到栈顶。\n"
" \n"
" -N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中右起,\n"
" -N\t转栈,使得第 N 个目录(\"dirs\" 显示的列表中右起,\n"
" \t\t从零开始)移动到栈顶。\n"
" \n"
" 目录\t将 <目录> 添加到栈顶,使其成为当前工作目录。\n"
+1
View File
@@ -468,6 +468,7 @@ here_document_to_fd (redirectee, ri)
{
if (pipe (herepipe) < 0)
{
/* XXX - goto use_tempfile; ? */
r = errno;
if (document != redirectee->word)
free (document);
+7
View File
@@ -1064,6 +1064,7 @@ subshell_exit (s)
/* Do trap[0] if defined. Allow it to override the exit status
passed to us. */
last_command_exit_value = s;
if (signal_is_trapped (0))
s = run_exit_trap ();
@@ -1127,6 +1128,7 @@ run_startup_files ()
#endif
int sourced_login, run_by_ssh;
#if 1 /* TAG:bash-5.3 andrew.gregory.8@gmail.com 2/21/2022 */
/* get the rshd/sshd case out of the way first. */
if (interactive_shell == 0 && no_rc == 0 && login_shell == 0 &&
act_like_sh == 0 && command_execution_string)
@@ -1136,11 +1138,16 @@ run_startup_files ()
(find_variable ("SSH2_CLIENT") != (SHELL_VAR *)0);
#else
run_by_ssh = 0;
#endif
#endif
/* If we were run by sshd or we think we were run by rshd, execute
~/.bashrc if we are a top-level shell. */
#if 1 /* TAG:bash-5.3 */
if ((run_by_ssh || isnetconn (fileno (stdin))) && shell_level < 2)
#else
if (isnetconn (fileno (stdin) && shell_level < 2)
#endif
{
#ifdef SYS_BASHRC
# if defined (__OPENNT)
+507 -28
View File
@@ -4,7 +4,7 @@
/* ``Have a little faith, there's magic in the night. You ain't a
beauty, but, hey, you're alright.'' */
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -195,6 +195,7 @@ int patsub_replacement = 1;
extern struct fd_bitmap *current_fds_to_close;
extern int wordexp_only;
extern int singlequote_translations;
extern int extended_quote;
#if defined (JOB_CONTROL) && defined (PROCESS_SUBSTITUTION)
extern PROCESS *last_procsub_child;
@@ -263,10 +264,11 @@ static int do_assignment_internal PARAMS((const WORD_DESC *, int));
static char *string_extract_verbatim PARAMS((char *, size_t, int *, char *, int));
static char *string_extract PARAMS((char *, int *, char *, int));
static char *string_extract_double_quoted PARAMS((char *, int *, int));
static inline char *string_extract_single_quoted PARAMS((char *, int *));
static inline char *string_extract_single_quoted PARAMS((char *, int *, int));
static inline int skip_single_quoted PARAMS((const char *, size_t, int, int));
static int skip_double_quoted PARAMS((char *, size_t, int, int));
static char *extract_delimited_string PARAMS((char *, int *, char *, char *, char *, int));
static char *extract_heredoc_dolbrace_string PARAMS((char *, int *, int, int));
static char *extract_dollar_brace_string PARAMS((char *, int *, int, int));
static int skip_matched_pair PARAMS((const char *, int, int, int, int));
@@ -341,6 +343,7 @@ static int shouldexp_replacement PARAMS((char *));
static char *pos_params_pat_subst PARAMS((char *, char *, char *, int));
static char *expand_string_for_patsub PARAMS((char *, int));
static char *parameter_brace_patsub PARAMS((char *, char *, array_eltstate_t *, char *, int, int, int));
static char *pos_params_casemod PARAMS((char *, char *, int, int));
@@ -737,16 +740,15 @@ unquoted_substring (substr, string)
INLINE char *
sub_append_string (source, target, indx, size)
char *source, *target;
int *indx;
size_t *indx;
size_t *size;
{
if (source)
{
int n;
size_t srclen;
size_t n, srclen;
srclen = STRLEN (source);
if (srclen >= (int)(*size - *indx))
if (srclen >= (*size - *indx))
{
n = srclen + *indx;
n = (n + DEFAULT_ARRAY_SIZE) - (n % DEFAULT_ARRAY_SIZE);
@@ -770,7 +772,7 @@ char *
sub_append_number (number, target, indx, size)
intmax_t number;
char *target;
int *indx;
size_t *indx;
size_t *size;
{
char *temp;
@@ -1090,22 +1092,38 @@ skip_double_quoted (string, slen, sind, flags)
/* Extract the contents of STRING as if it is enclosed in single quotes.
SINDEX, when passed in, is the offset of the character immediately
following the opening single quote; on exit, SINDEX is left pointing after
the closing single quote. */
the closing single quote. ALLOWESC allows the single quote to be quoted by
a backslash; it's not used yet. */
static inline char *
string_extract_single_quoted (string, sindex)
string_extract_single_quoted (string, sindex, allowesc)
char *string;
int *sindex;
int allowesc;
{
register int i;
size_t slen;
char *t;
int pass_next;
DECLARE_MBSTATE;
/* Don't need slen for ADVANCE_CHAR unless multibyte chars possible. */
slen = (MB_CUR_MAX > 1) ? strlen (string + *sindex) + *sindex : 0;
i = *sindex;
while (string[i] && string[i] != '\'')
ADVANCE_CHAR (string, slen, i);
pass_next = 0;
while (string[i])
{
if (pass_next)
{
pass_next = 0;
ADVANCE_CHAR (string, slen, i);
continue;
}
if (allowesc && string[i] == '\\')
pass_next++;
else if (string[i] == '\'')
break;
ADVANCE_CHAR (string, slen, i);
}
t = substring (string, *sindex, i);
@@ -1162,7 +1180,7 @@ string_extract_verbatim (string, slen, sindex, charlist, flags)
if ((flags & SX_NOCTLESC) && charlist[0] == '\'' && charlist[1] == '\0')
{
temp = string_extract_single_quoted (string, sindex);
temp = string_extract_single_quoted (string, sindex, 0);
--*sindex; /* leave *sindex at separator character */
return temp;
}
@@ -1501,6 +1519,285 @@ extract_delimited_string (string, sindex, opener, alt_opener, closer, flags)
return (result);
}
/* A simplified version of extract_dollar_brace_string that exists to handle
$'...' and $"..." quoting in here-documents, since the here-document read
path doesn't. It's separate because we don't want to mess with the fast
common path. We already know we're going to allocate and return a new
string and quoted == Q_HERE_DOCUMENT. We might be able to cut it down
some more, but extracting strings and adding them as we go adds complexity.
This needs to match the logic in parse.y:parse_matched_pair so we get
consistent behavior between here-documents and double-quoted strings. */
static char *
extract_heredoc_dolbrace_string (string, sindex, quoted, flags)
char *string;
int *sindex, quoted, flags;
{
register int i, c;
size_t slen, tlen, result_index, result_size;
int pass_character, nesting_level, si, dolbrace_state;
char *result, *t, *send;
DECLARE_MBSTATE;
pass_character = 0;
nesting_level = 1;
slen = strlen (string + *sindex) + *sindex;
send = string + slen;
result_size = slen;
result_index = 0;
result = xmalloc (result_size + 1);
/* This function isn't called if this condition is not true initially. */
dolbrace_state = DOLBRACE_QUOTE;
i = *sindex;
while (c = string[i])
{
if (pass_character)
{
pass_character = 0;
RESIZE_MALLOCED_BUFFER (result, result_index, locale_mb_cur_max + 1, result_size, 64);
COPY_CHAR_I (result, result_index, string, send, i);
continue;
}
/* CTLESCs and backslashes quote the next character. */
if (c == CTLESC || c == '\\')
{
pass_character++;
RESIZE_MALLOCED_BUFFER (result, result_index, 2, result_size, 64);
result[result_index++] = c;
i++;
continue;
}
/* The entire reason we have this separate function right here. */
if (c == '$' && string[i+1] == '\'')
{
char *ttrans;
int ttranslen;
if ((posixly_correct || extended_quote == 0) && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2)
{
RESIZE_MALLOCED_BUFFER (result, result_index, 3, result_size, 64);
result[result_index++] = '$';
result[result_index++] = '\'';
i += 2;
continue;
}
si = i + 2;
t = string_extract_single_quoted (string, &si, 1); /* XXX */
CHECK_STRING_OVERRUN (i, si, slen, c);
tlen = si - i - 2; /* -2 since si is one after the close quote */
ttrans = ansiexpand (t, 0, tlen, &ttranslen);
free (t);
/* needed to correctly quote any embedded single quotes. */
if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_QUOTE2)
{
t = sh_single_quote (ttrans);
tlen = strlen (t);
free (ttrans);
}
else if (extended_quote) /* dolbrace_state == DOLBRACE_PARAM */
{
/* This matches what parse.y:parse_matched_pair() does */
t = ttrans;
tlen = strlen (t);
}
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 1, result_size, 64);
strncpy (result + result_index, t, tlen);
result_index += tlen;
free (t);
i = si;
continue;
}
#if defined (TRANSLATABLE_STRINGS)
if (c == '$' && string[i+1] == '"')
{
char *ttrans;
int ttranslen;
si = i + 2;
t = string_extract_double_quoted (string, &si, flags); /* XXX */
CHECK_STRING_OVERRUN (i, si, slen, c);
tlen = si - i - 2; /* -2 since si is one after the close quote */
ttrans = locale_expand (t, 0, tlen, line_number, &ttranslen);
free (t);
t = singlequote_translations ? sh_single_quote (ttrans) : sh_mkdoublequoted (ttrans, ttranslen, 0);
tlen = strlen (t);
free (ttrans);
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 1, result_size, 64);
strncpy (result + result_index, t, tlen);
result_index += tlen;
free (t);
i = si;
continue;
}
#endif /* TRANSLATABLE_STRINGS */
if (c == '$' && string[i+1] == LBRACE)
{
nesting_level++;
RESIZE_MALLOCED_BUFFER (result, result_index, 3, result_size, 64);
result[result_index++] = c;
result[result_index++] = string[i+1];
i += 2;
if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_QUOTE2 || dolbrace_state == DOLBRACE_WORD)
dolbrace_state = DOLBRACE_PARAM;
continue;
}
if (c == RBRACE)
{
nesting_level--;
if (nesting_level == 0)
break;
RESIZE_MALLOCED_BUFFER (result, result_index, 2, result_size, 64);
result[result_index++] = c;
i++;
continue;
}
/* Pass the contents of old-style command substitutions through
verbatim. */
if (c == '`')
{
si = i + 1;
t = string_extract (string, &si, "`", flags); /* already know (flags & SX_NOALLOC) == 0) */
CHECK_STRING_OVERRUN (i, si, slen, c);
tlen = si - i - 1;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 3, result_size, 64);
result[result_index++] = c;
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si];
free (t);
i = si + 1;
continue;
}
/* Pass the contents of new-style command substitutions and
arithmetic substitutions through verbatim. */
if (string[i] == '$' && string[i+1] == LPAREN)
{
si = i + 2;
t = extract_command_subst (string, &si, flags);
CHECK_STRING_OVERRUN (i, si, slen, c);
tlen = si - i - 1;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64);
result[result_index++] = c;
result[result_index++] = LPAREN;
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si];
free (t);
i = si + 1;
continue;
}
#if defined (PROCESS_SUBSTITUTION)
/* Technically this should only work at the start of a word */
if ((string[i] == '<' || string[i] == '>') && string[i+1] == LPAREN)
{
si = i + 2;
t = extract_process_subst (string, (string[i] == '<' ? "<(" : ">)"), &si, flags);
CHECK_STRING_OVERRUN (i, si, slen, c);
tlen = si - i - 1;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64);
result[result_index++] = c;
result[result_index++] = LPAREN;
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si];
free (t);
i = si + 1;
continue;
}
#endif
if (c == '\'' && posixly_correct && shell_compatibility_level > 42 && dolbrace_state != DOLBRACE_QUOTE)
{
COPY_CHAR_I (result, result_index, string, send, i);
continue;
}
/* Pass the contents of single and double-quoted strings through verbatim. */
if (c == '"' || c == '\'')
{
si = i + 1;
if (c == '"')
t = string_extract_double_quoted (string, &si, flags);
else
t = string_extract_single_quoted (string, &si, 0);
CHECK_STRING_OVERRUN (i, si, slen, c);
tlen = si - i - 2; /* -2 since si is one after the close quote */
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 3, result_size, 64);
result[result_index++] = c;
strncpy (result + result_index, t, tlen);
result_index += tlen;
result[result_index++] = string[si - 1];
free (t);
i = si;
continue;
}
/* copy this character, which was not special. */
COPY_CHAR_I (result, result_index, string, send, i);
/* This logic must agree with parse.y:parse_matched_pair, since they
share the same defines. */
if (dolbrace_state == DOLBRACE_PARAM && c == '%' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
else if (dolbrace_state == DOLBRACE_PARAM && c == '#' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
else if (dolbrace_state == DOLBRACE_PARAM && c == '/' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE2; /* XXX */
else if (dolbrace_state == DOLBRACE_PARAM && c == '^' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
else if (dolbrace_state == DOLBRACE_PARAM && c == ',' && (i - *sindex) > 1)
dolbrace_state = DOLBRACE_QUOTE;
/* This is intended to handle all of the [:]op expansions and the substring/
length/pattern removal/pattern substitution expansions. */
else if (dolbrace_state == DOLBRACE_PARAM && strchr ("#%^,~:-=?+/", c) != 0)
dolbrace_state = DOLBRACE_OP;
else if (dolbrace_state == DOLBRACE_OP && strchr ("#%^,~:-=?+/", c) == 0)
dolbrace_state = DOLBRACE_WORD;
}
if (c == 0 && nesting_level)
{
free (result);
if (no_longjmp_on_fatal_error == 0)
{ /* { */
last_command_exit_value = EXECUTION_FAILURE;
report_error (_("bad substitution: no closing `%s' in %s"), "}", string);
exp_jump_to_top_level (DISCARD);
}
else
{
*sindex = i;
return ((char *)NULL);
}
}
*sindex = i;
result[result_index] = '\0';
return (result);
}
/* Extract a parameter expansion expression within ${ and } from STRING.
Obey the Posix.2 rules for finding the ending `}': count braces while
skipping over enclosed quoted strings and command substitutions.
@@ -1520,10 +1817,6 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
char *result, *t;
DECLARE_MBSTATE;
pass_character = 0;
nesting_level = 1;
slen = strlen (string + *sindex) + *sindex;
/* The handling of dolbrace_state needs to agree with the code in parse.y:
parse_matched_pair(). The different initial value is to handle the
case where this function is called to parse the word in
@@ -1532,6 +1825,13 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
dolbrace_state = DOLBRACE_QUOTE;
if (quoted == Q_HERE_DOCUMENT && dolbrace_state == DOLBRACE_QUOTE && (flags & SX_NOALLOC) == 0)
return (extract_heredoc_dolbrace_string (string, sindex, quoted, flags));
pass_character = 0;
nesting_level = 1;
slen = strlen (string + *sindex) + *sindex;
i = *sindex;
while (c = string[i])
{
@@ -1554,6 +1854,8 @@ extract_dollar_brace_string (string, sindex, quoted, flags)
{
nesting_level++;
i += 2;
if (dolbrace_state == DOLBRACE_QUOTE || dolbrace_state == DOLBRACE_WORD)
dolbrace_state = DOLBRACE_PARAM;
continue;
}
@@ -3603,6 +3905,104 @@ expand_assignment_string_to_string (string, quoted)
return (expand_string_to_string_internal (string, quoted, expand_string_assignment));
}
/* Kind of like a combination of dequote_string and quote_string_for_globbing;
try to remove CTLESC quoting characters and convert CTLESC escaping a `&'
or a backslash into a backslash. The output of this function must eventually
be processed by strcreplace(). */
static char *
quote_string_for_repl (string, flags)
char *string;
int flags;
{
size_t slen;
char *result, *t;
const char *s, *send;
DECLARE_MBSTATE;
slen = strlen (string);
send = string + slen;
result = (char *)xmalloc (slen * 2 + 1);
if (string[0] == CTLESC && string[1] == 0)
{
result[0] = CTLESC;
result[1] = '\0';
return (result);
}
/* This is awkward. We want to translate CTLESC-\ to \\ if we will
eventually send this string through strcreplace(), which we will do
only if shouldexp_replacement() determines that there is something
to replace. We can either make sure to escape backslashes here and
have shouldexp_replacement() signal that we should send the string to
strcreplace() if it sees an escaped backslash, or we can scan the
string before copying it and turn CTLESC-\ into \\ only if we encounter
a CTLESC-& or a &. This does the former and changes shouldexp_replacement().
If we double the backslashes here, we'll get doubled backslashes in any
result that doesn't get passed to strcreplace(). */
for (s = string, t = result; *s; )
{
/* This function's result has to be processed by strcreplace() */
if (*s == CTLESC && (s[1] == '&' || s[1] == '\\'))
{
*t++ = '\\';
s++;
*t++ = *s++;
continue;
}
/* Dequote it */
if (*s == CTLESC)
{
s++;
if (*s == '\0')
break;
}
COPY_CHAR_P (t, s, send);
}
*t = '\0';
return (result);
}
/* This does not perform word splitting on the WORD_LIST it returns and
it treats $* as if it were quoted. It dequotes the WORD_LIST, adds
backslash escapes before CTLESC-quoted backslash and `& if
patsub_replacement is enabled. */
static char *
expand_string_for_patsub (string, quoted)
char *string;
int quoted;
{
WORD_LIST *value;
char *ret, *t;
if (string == 0 || *string == '\0')
return (char *)NULL;
value = expand_string_for_pat (string, quoted, (int *)0, (int *)0);
if (value && value->word)
{
remove_quoted_nulls (value->word->word); /* XXX */
value->word->flags &= ~W_HASQUOTEDNULL;
}
if (value)
{
t = (value->next) ? string_list (value) : value->word->word;
ret = quote_string_for_repl (t, quoted);
if (t != value->word->word)
free (t);
dispose_words (value);
}
else
ret = (char *)NULL;
return (ret);
}
char *
expand_arith_string (string, quoted)
char *string;
@@ -3762,8 +4162,8 @@ expand_string_dollar_quote (string, flags)
char *string;
int flags;
{
size_t slen;
int sindex, c, translen, retind, retsize, peekc, news;
size_t slen, retind, retsize;
int sindex, c, translen, peekc, news;
char *ret, *trans, *send, *t;
DECLARE_MBSTATE;
@@ -3792,6 +4192,25 @@ expand_string_dollar_quote (string, flags)
COPY_CHAR_I (ret, retind, string, send, sindex);
break;
case '\'':
case '"':
if (c == '\'')
news = skip_single_quoted (string, slen, ++sindex, SX_COMPLETE);
else
news = skip_double_quoted (string, slen, ++sindex, SX_COMPLETE);
translen = news - sindex - 1;
RESIZE_MALLOCED_BUFFER (ret, retind, translen + 3, retsize, 64);
ret[retind++] = c;
if (translen > 0)
{
strncpy (ret + retind, string + sindex, translen);
retind += translen;
}
if (news > sindex && string[news - 1] == c)
ret[retind++] = c;
sindex = news;
break;
case CTLESC:
RESIZE_MALLOCED_BUFFER (ret, retind, locale_mb_cur_max + 2, retsize, 64);
if (flags)
@@ -3808,14 +4227,31 @@ expand_string_dollar_quote (string, flags)
if (peekc != '\'')
#endif
{
RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 16);
RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 16);
ret[retind++] = c;
break;
}
if (string[sindex + 1] == '\0') /* don't bother */
{
RESIZE_MALLOCED_BUFFER (ret, retind, 3, retsize, 16);
ret[retind++] = c;
ret[retind++] = peekc;
sindex++;
break;
}
if (peekc == '\'')
{
/* SX_COMPLETE is the equivalent of ALLOWESC here */
/* We overload SX_COMPLETE below */
news = skip_single_quoted (string, slen, ++sindex, SX_COMPLETE);
/* Check for unclosed string and don't bother if so */
if (news > sindex && string[news] == '\0' && string[news-1] != peekc)
{
RESIZE_MALLOCED_BUFFER (ret, retind, 3, retsize, 16);
ret[retind++] = c;
ret[retind++] = peekc;
continue;
}
t = substring (string, sindex, news - 1);
trans = ansiexpand (t, 0, news-sindex-1, &translen);
free (t);
@@ -3827,6 +4263,15 @@ expand_string_dollar_quote (string, flags)
{
news = ++sindex;
t = string_extract_double_quoted (string, &news, SX_COMPLETE);
/* Check for unclosed string and don't bother if so */
if (news > sindex && string[news] == '\0' && string[news-1] != peekc)
{
RESIZE_MALLOCED_BUFFER (ret, retind, 3, retsize, 16);
ret[retind++] = c;
ret[retind++] = peekc;
free (t);
continue;
}
trans = locale_expand (t, 0, news-sindex, 0, &translen);
free (t);
if (singlequote_translations &&
@@ -6327,8 +6772,9 @@ read_comsub (fd, quoted, flags, rflag)
int *rflag;
{
char *istring, buf[COMSUB_PIPEBUF], *bufp;
int istring_index, c, tflag, skip_ctlesc, skip_ctlnul;
int c, tflag, skip_ctlesc, skip_ctlnul;
int mb_cur_max;
size_t istring_index;
size_t istring_size;
ssize_t bufn;
int nullbyte;
@@ -6666,6 +7112,11 @@ command_substitute (string, quoted, flags)
remove_quoted_escapes (string);
/* We want to expand aliases on this pass if we are not in posix mode
for backwards compatibility. */
if (expand_aliases)
expand_aliases = posixly_correct == 0;
startup_state = 2; /* see if we can avoid a fork */
parse_and_execute_level = 0;
@@ -6971,6 +7422,13 @@ parameter_brace_expand_word (name, var_is_special, quoted, pflags, estatep)
ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
(int *)NULL, (int *)NULL, pflags);
/* Make sure we note that we saw a quoted null string and pass the flag back
to the caller in addition to the value. */
if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) && STR_DOLLAR_AT_STAR (name) &&
ret && ret->word && QUOTED_NULL (ret->word))
ret->flags |= W_HASQUOTEDNULL;
free (tt);
}
#if defined (ARRAY_VARS)
@@ -7024,8 +7482,13 @@ expand_arrayref:
if (estatep)
*estatep = es; /* structure copy */
}
/* Note that array[*] and array[@] expanded to a quoted null string by
returning the W_HASQUOTEDNULL flag to the caller in addition to TEMP. */
else if (es.subtype == 1 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
rflags |= W_HASQUOTEDNULL;
else if (es.subtype == 2 && temp && QUOTED_NULL (temp) && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
rflags |= W_HASQUOTEDNULL;
if (estatep == 0)
flush_eltstate (&es);
}
@@ -8432,6 +8895,8 @@ shouldexp_replacement (s)
preceding the special character. */
if (s[sindex] == '&')
return 1;
if (s[sindex] == '\\')
return 1;
}
else if (c == '&')
return 1;
@@ -8696,8 +9161,10 @@ parameter_brace_patsub (varname, value, estatep, patsub, quoted, pflags, flags)
the entire expansion is double-quoted because the parser and string
extraction functions treated quotes in the replacement string as
special. THIS IS NOT BACKWARDS COMPATIBLE WITH BASH-4.2. */
if (shell_compatibility_level > 42)
if (shell_compatibility_level > 42 && patsub_replacement == 0)
rep = expand_string_if_necessary (rep, quoted & ~(Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT), expand_string_unsplit);
else if (shell_compatibility_level > 42 && patsub_replacement)
rep = expand_string_for_patsub (rep, quoted & ~(Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT));
/* This is the bash-4.2 code. */
else if ((mflags & MATCH_QUOTED) == 0)
rep = expand_string_if_necessary (rep, quoted, expand_string_unsplit);
@@ -8706,9 +9173,7 @@ parameter_brace_patsub (varname, value, estatep, patsub, quoted, pflags, flags)
/* Check whether or not to replace `&' in the replacement string after
expanding it, since we want to treat backslashes quoting the `&'
consistently. The replacement string already undergoes quote removal
above, so users need to make sure any desired backslash makes it
through that. */
consistently. */
if (patsub_replacement && rep && *rep && shouldexp_replacement (rep))
mflags |= MATCH_EXPREP;
@@ -9670,6 +10135,14 @@ bad_substitution:
}
else /* VAR not set or VAR is NULL. */
{
/* If we're freeing a quoted null here, we need to remember we saw
it so we can restore it later if needed, or the caller can note it.
The check against `+' doesn't really matter, since the other cases
don't use or return TFLAG, but it's good for clarity. */
if (c == '+' && temp && QUOTED_NULL (temp) &&
(quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)))
tflag |= W_HASQUOTEDNULL;
FREE (temp);
temp = (char *)NULL;
if (c == '=' && var_is_special)
@@ -10452,7 +10925,7 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
size_t istring_size;
/* Index into ISTRING. */
int istring_index;
size_t istring_index;
/* Temporary string storage. */
char *temp, *temp1;
@@ -10494,7 +10967,9 @@ expand_word_internal (word, quoted, isexp, contains_dollar_at, expanded_somethin
DECLARE_MBSTATE;
/* OK, let's see if we can optimize a common idiom: "$@" */
/* OK, let's see if we can optimize a common idiom: "$@". This needs to make sure
that all of the flags callers care about (e.g., W_HASQUOTEDNULL) are set in
list->flags. */
if (STREQ (word->word, "\"$@\"") &&
(word->flags == (W_HASDOLLAR|W_QUOTED)) &&
dollar_vars[1]) /* XXX - check IFS here as well? */
@@ -11083,7 +11558,7 @@ add_twochars:
goto add_character;
t_index = ++sindex;
temp = string_extract_single_quoted (string, &sindex);
temp = string_extract_single_quoted (string, &sindex, 0);
/* If the entire STRING was surrounded by single quotes,
then the string is wholly quoted. */
@@ -11224,7 +11699,11 @@ finished_with_string:
if (*istring == '\0')
{
#if 0
if (quoted_dollar_at == 0 && (had_quoted_null || quoted_state == PARTIALLY_QUOTED))
#else
if (had_quoted_null || (quoted_dollar_at == 0 && quoted_state == PARTIALLY_QUOTED))
#endif
{
istring[0] = CTLNUL;
istring[1] = '\0';
@@ -11433,7 +11912,7 @@ string_quote_removal (string, quoted)
break;
}
tindex = sindex + 1;
temp = string_extract_single_quoted (string, &tindex);
temp = string_extract_single_quoted (string, &tindex, 0);
if (temp)
{
strcpy (r, temp);
+1 -1
View File
@@ -146,7 +146,7 @@ extern int do_word_assignment PARAMS((WORD_DESC *, int));
of space allocated to TARGET. SOURCE can be NULL, in which
case nothing happens. Gets rid of SOURCE by free ()ing it.
Returns TARGET in case the location has changed. */
extern char *sub_append_string PARAMS((char *, char *, int *, size_t *));
extern char *sub_append_string PARAMS((char *, char *, size_t *, size_t *));
/* Append the textual representation of NUMBER to TARGET.
INDEX and SIZE are as in SUB_APPEND_STRING. */
+6 -2
View File
@@ -4,7 +4,7 @@
#
# The bug address depends on the release status of the shell. Versions
# with status `devel', `alpha', `beta', or `rc' mail bug reports to
# chet@cwru.edu and, optionally, to bash-testers@cwru.edu.
# chet.ramey@case.edu and, optionally, to bash-testers@cwru.edu.
# Other versions send mail to bug-bash@gnu.org.
#
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
@@ -102,7 +102,7 @@ esac
BASHTESTERS="bash-testers@cwru.edu"
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*) BUGBASH=chet@cwru.edu ;;
alpha*|beta*|devel*|rc*) BUGBASH=chet.ramey@case.edu ;;
*) BUGBASH=bug-bash@gnu.org ;;
esac
@@ -132,6 +132,10 @@ if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/xemacs ]; then
DEFEDITOR=xemacs
elif [ -x /usr/bin/vim; then
DEFEDITOR=vim
elif [ -x /usr/bin/gvim; then
DEFEDITOR=gvim
elif [ -x /usr/bin/nano ]; then
DEFEDITOR=nano
elif [ -x /usr/contrib/bin/jove ]; then
+3 -1
View File
@@ -13,9 +13,11 @@
#
# this is a new feature: expanding aliases when initially parsing command
# substitutions
# substitutions. required by posix, so enabled in posix mode. default mode
# stays backwards compatible.
shopt -s expand_aliases
set -o posix
alias switch=case
+19
View File
@@ -1,3 +1,17 @@
# 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/>.
#
# first, let's start with the basics
recho "$@"
@@ -246,6 +260,11 @@ ${THIS_SH} ./dollar-at-star8.sub
# with different values for IFS
${THIS_SH} ./dollar-at-star9.sub
# tests for expansions of "$*" and "$@" and their array equivalents when $1 == ''
# and we're using the POSIX word expansions
${THIS_SH} ./dollar-at-star10.sub
${THIS_SH} ./dollar-at-star11.sub
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
+66
View File
@@ -0,0 +1,66 @@
# checks for array variables and positional parameter expansions losing quoted
# null string expansions -- problem through bash-5.1
set -- ''
myvar[0]=
a="${myvar[*]}"
recho "$*"
recho "${*}"
recho "${a}"
recho "${myvar[*]}"
recho "${a:+nonnull}"
recho "${myvar[*]:+nonnull}"
a="${myvar[@]}"
recho "$@"
recho "${@}"
recho "${a}"
recho "${myvar[@]}"
recho "${a:+nonnull}"
recho "${myvar[@]:+nonnull}"
# check to make sure literal CTLNULs are handled correctly
set -- $'\x7f'
recho "$@"
recho "${@}"
recho "${@:+nonnull}"
recho "$*"
recho "${*}"
recho "${*:+nonnull}"
shift $#
# these should echo nothing
recho "${@}"
recho "${@:+nonnull}"
unset -v a
# make sure that other null expansions result in null strings where appropriate
set -- ''
a[0]=
recho "$*"$x
recho "${*}"$x
recho "$@"$x
recho "${@}"$x
recho "${a[*]}"$x
recho "${a[@]}"$x
recho "$@"$x
recho "${@}"$x
recho "${a[*]}"
recho "${a[@]}"
+80
View File
@@ -0,0 +1,80 @@
a[0]='/'
set -- /
# these should all result in the empty (null) string
recho "${a[0]%?}"
recho "${a[*]%?}"
recho "${a[@]%?}"
recho "${*%?}"
recho "${@%?}"
recho "${a[0]#?}"
recho "${a[*]#?}"
recho "${a[@]#?}"
recho "${*#?}"
recho "${@#?}"
recho "${a[0]/\//}"
recho "${a[*]/\//}"
recho "${a[@]/\//}"
recho "${*/\//}"
recho "${@/\//}"
recho "${a[0]:1:1}"
# these next four will all echo /
# arrays are zero-based
recho "${a[*]:0:1}"
recho "${a[@]:0:1}"
# but the positional parameters start at 1
recho "${*:1:1}"
recho "${@:1:1}"
a[0]=''
set -- ''
# arrays are zero-based
recho "${a[*]:0:1}"
recho "${a[@]:0:1}"
recho "${*:1:1}"
recho "${@:1:1}"
# these should all result in the empty (null) string, or quoted as such
recho "${a[0]@Q}"
recho "${a[*]@Q}"
recho "${a[@]@Q}"
recho "${*@Q}"
recho "${@@Q}"
recho "${a[0]@L}"
recho "${a[*]@L}"
recho "${a[@]@L}"
recho "${*@L}"
recho "${@@L}"
# examples from the bug report
unset -v a
a[0]='/'
for i in "${a[@]%/}"; do recho "$i"; done
a[0]=''
for i in "${a[@]}"; do recho "$i"; done
a[0]='/'
a[1]="//"
for i in "${a[@]%/}"; do recho "$i"; done
unset -v x y
x=('/')
y=("${x[@]%/}")
echo "${#x[@]}:${#y[@]}"
+67
View File
@@ -399,6 +399,73 @@ argv[1] = <^?>
argv[1] = <^?>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <^?>
argv[1] = <^?>
argv[1] = <nonnull>
argv[1] = <^?>
argv[1] = <^?>
argv[1] = <nonnull>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = </>
argv[1] = </>
argv[1] = </>
argv[1] = </>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <''>
argv[1] = <''>
argv[1] = <''>
argv[1] = <''>
argv[1] = <''>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = <>
argv[1] = </>
1:1
xa|xb|xc
xa|xb|xc
a|b|c
+28
View File
@@ -142,3 +142,31 @@ w
x
y
z
=====
WORKS
done
WORKS
a
b
c
d
a
b
c
d
e
A
B
c
d
c
d
e
x
y
z
WORKS
w
x
y
z

Some files were not shown because too many files have changed in this diff Show More