bash-5.0-beta2 release

This commit is contained in:
Chet Ramey
2018-11-23 15:32:57 -05:00
parent 2f5dfe5a18
commit 2ae59c1134
183 changed files with 27023 additions and 22115 deletions
+111
View File
@@ -1,3 +1,114 @@
This document details the changes between this version, bash-5.0-beta2, and
the previous version, bash-5.0-beta.
1. Changes to Bash
a. Fixed a bug that could cause a seg fault while parsing a subshell command
inside a command substitution.
b. Fixed several small memory leaks uncovered by coverity.
c. Fixed a problem with command substitution inside an interactive shell that
could cause the parent to receive a SIGHUP.
d. Fixed a problem with using `*' and `@' as subscripts when assigning values
to an associative array with assoc_expand_once enabled.
e. Fixed a bug that could cause a huge memory allocation when completing a
word beginning with an invalid tilde expansion.
f. Cleaned up some incompatiblities with bash-4.4 when expanding indexed array
subscripts used in arithmetic expansions when assoc_expand_once is enabled.
g. The ${parameter@a} expansion will display attributes even if `parameter' is
unset.
h. Fixed a bug that caused the output of `set' to cut off some variables before
printing the value.
i. Treat a failure to assign a variable when using the ${x:=value} expansion
as an expansion error, so non-interactive posix-mode shells exit
j. Fixed a problem when expanding $* in a context where word splitting is not
performed when IFS is NULL.
k. Temp files used to store here documents are forced readable, no matter what
the user's umask says.
l. Fixed a problem where an interrupted brace expansion could cause the shell
to attempt to free an invalid memory location.
m. Make sure to check for any terminating signals after running a trap
handler; don't wait until the next time we process traps.
n. Fixed a bug that caused "return" to act like a special builtin with respect
to variable assignments even when preceded by "command".
o. POSIX-mode shells now return failure if the cd builtin fails due to the
absolute directory name being longer than PATH_MAX, instead of trying
again with a relative pathname.
p. Fixed a problem with FUNCNAME occasionally being visible when not executing
a shell function.
q. Fixed a problem with the expansions performed on the WORD in the case
command.
r. Fixed a slight POSIX compatibility when removing "IFS whitespace" during
word splitting and the read builtin.
s. Fixed a problem with expanding an array with subscript `*' when all the
elements expand to the empty string, and making sure the expansion honors
the `:' specifier.
2. Changes to Readline
a. Fixed a bug with adding multibyte characters to an incremental search string.
b. Fixed a bug with redoing text insertions in vi mode.
c. Fixed a bug with pasting text into an incremental search string if bracketed
paste mode is enabled. ESC cannot be one of the incremental search
terminator characters for this to work.
d. Fixed a bug with anchored search patterns when performing searches in vi
mode.
3. New Features in Bash
a. Associative and indexed arrays now allow subscripts consisting solely of
whitespace.
b. `checkwinsize' is now enabled by default.
c. The `localvar_unset' shopt option is now visible and documented.
d. The `progcomp_alias' shopt option is now visible and documented.
e. The signal name processing code now understands `SIGRTMIN+n' all the way
up to SIGRTMAX.
f. There is a new `seq' loadable builtin.
g. Trap execution now honors the (internal) max invocations of `eval', since
traps are supposed to be executed as if using `eval'.
h. The $_ variable doesn't change when the shell executes a command that forks.
i. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
conforming applications aren't supposed to use them.
j. POSIX mode now enables the `shift_verbose' option.
4. New Features in Readline
a. Readline now allows application-defined keymap names; there is a new public
function, rl_set_keymap_name(), to do that.
b. The "Insert" keypad key, if available, now puts readline into overwrite
mode.
------------------------------------------------------------------------------
This document details the changes between this version, bash-5.0-beta, and
the previous version, bash-5.0-alpha.
+459
View File
@@ -4303,3 +4303,462 @@ configure.ac
- openbsd needs DEV_FD_STAT_BROKEN defined
[bash-5.0-beta frozen]
9/11
----
builtins/exec.def
- exec_builtin: make sure to sync the buffered stream where bash is
reading input (especially if it's fd 0) so a command exec'd by the
script can read the rest of stdin after the exec
9/15
----
lib/readline/histexpand.c
- history_tokenize_internal: if the event contains embedded newlines
(e.g., bash with command-oriented history and lithist), use them as
word delimiters, equivalent to space and tab, so they don't end up
as separate words. Fixes issue pointed out by Viktor Dukhovni
<ietf-dane@dukhovni.org>
- history_tokenize_word: don't break if we get a newline (though we
shouldn't get one due to the loop in history_tokenize_internal
- history_expand_internal: use newline as a whitespace character when
expanding by words, as we do with history_tokenize_internal
jobs.h
- J_PIPEFAIL: new flag for `flags' element of job struct
jobs.c
- stop_pipeline: if pipefail_opt set, newjob gets J_PIPEFAIL in its
flags word
- raw_job_exit_status: use J_PIPEFAIL (setting of pipefail when job
created) instead of current setting of pipefail status to determine
how to compute exit status of pipeline. Tentative implementation of
Posix proposal
expr.c
- exp0: don't call expr_bind_variable with a NULL string. Fixes
fuzzing bug reported by Eduardo Bustamante <dualbus@gmail.com>
- expr_bind_variable: don't try to do anything with a NULL or empty
LHS
9/16
----
lib/readline/undo.c
- rl_do_undo: before we release the undo list entry we've just
processed, make sure we avoid any pointer aliasing issues caused
by having the entry being removed as part of the undo list in
_rl_saved_line_for_history. Fixes fuzzing bug reported by
Eduardo Bustamante <dualbus@gmail.com>
9/17
----
[bash-5.0-beta released]
9/18
----
lib/readline/bind.c
- name_and_keymap: new struct for keymap names and maps
- builtin_keymap_names: static array of builtin keymap names and
maps; preparing for allowing applications to set the names of
keymaps they create; keymap_names is initially a pointer to
this array
- _rl_get_keymap_by_name,_rl_get_keymap_by_map: new functions for
searching the keymap_names array and returning an index
- rl_get_keymap_by_name, rl_get_keymap_name: rewritten in terms of
new functions above
- rl_set_keymap_name (char *name, Keymap map): new function, set
name of MAP to NAME. NAME must not be builtin; MAP must not be one
of the builtin keymaps. Request and initial implementation from
Tom Tromey <tom@tromey.com>
lib/readline/readline.h
- rl_set_keymap_name: new extern declaration for new public function
lib/readline/doc/rltech.texi
- rl_set_keymap_name: add documentation
lib/readline/doc/rluser.texi
- add text to `set keymap' description to note that applications
can add keymap names that can be used there
9/20
----
parse.y
- shell_getc: don't execute the alias hack (returning a space at the
end of the string) if we are parsing a command substitution that
starts with a double paren (subshell inside a comsub), in which
case the flags are PSH_DPAREN. Fixes fuzzing bug reported by
Eduardo Bustamante <dualbus@gmail.com>
lib/readline/isearch.c
- _rl_isearch_dispatch: default case: make sure we check multibyte
char length when deciding whether to enlarge the search string
buffer, instead of using the old assumption. Fixes fuzzing bug
reported by Eduardo Bustamante <dualbus@gmail.com>
builtins/fc.def,execute_cmd.c
- fixed some missing free()s uncovered by coverity. Report from
Siteshwar Vashisht <svashisht@redhat.com>
lib/glob/glob.c
- glob_vector: make sure name_vector is initialized to NULL
lib/sh/{pathcanon,pathphys}.c
- {pathcanon,pathphys}: use memmove instead of strcpy on a possibly-
overlapping region of memory
subst.c
- parameter_list_transform: make sure to dispose the word list in all
cases before returning
- parameter_brace_expand_rhs: make sure t1 is freed before returning
due to an invalid name resulting from an indirect expansion
support/man2html.c
- fixed a couple of memory leaks
9/21
----
subst.c
- process_substitute: if we are part of a job control process chain
(pipeline_pgrp != shell_pgrp), have the child shell forked to run
the process substitution set pipeline_pgrp to its own PID,
effectively becoming a process group leader without changing
its own process group. Fixes stray SIGHUP issue reported by
Jeremy Townshend <jeremy.townshend@gmail.com>
9/23
----
arrayfunc.c
- assign_array_element: if we are assigning to an existing associative
array, and assoc_expand_once is set, allow `*' and `@' as subscripts.
Partial fix for report from Grisha Levit <grishalevit@gmail.com>
variables.c
- bind_int_variable: if valid_array_reference (lhs) is not true,
make sure that the lhs is a valid identifier before assigning the
value
arrayfunc.c
- valid_array_reference: allow blank subscripts. They are treated as
`normal' keys for associative arrays and evaluate to 0 for indexed
arrays. More of fix for report from Grisha Levit
<grishalevit@gmail.com>
9/24
----
bashline.c
- restore_tilde: if the expanded length (xl) is longer than vl
we end up requesting a negative amount of memory (an extremely
large unsigned number). Just punt and return val in this case.
Fuzzing bug reported by Eduardo Bustamante <dualbus@gmail.com>
- restore_tilde: make sure we return what the user typed if tilde
expansion fails
9/29
----
builtins/shopt.def
- uncomment `localvar_unset' option definition
doc/{bash.1,bashref.texi}
- document `localvar_unset' shell option
arrayfunc.c
- valid_array_reference: if we are parsing a subscript for an existing
associative array, the `assoc_expand_once' option is set, and the
VA_ONEWORD flag is set in FLAGS (meaning there should be nothing
following the closing `]'), don't call skipsubscript to find the
closing `]', use one that is at the end of the word. Part of fix for
issue reported by Grisha Levit <grishalevit@gmail.com>
builtins/{printf,set}.def
- pass VA_ONEWORD as part of flags value everywhere valid_array_reference
is used
config-top.h
- CHECKWINSIZE_DEFAULT: now 1, so check_window_size is on by default
- HISTEXPAND_DEFAULT: new define, allows builder to enable or disable
history expansion by default at build time
doc/{bash.1,bashref.texi}
- checkwinsize: document new default value
bashhist.h
- HISTEXPAND_DEFAULT: don't define if it's already defined. Strict
POSIX mode continues to default to off
9/30
----
lib/readline/input.c
- win32_isatty: win32-specific changes from GDB. Patch submitted by
Tom Tromey <tom@tromey.com>, originally from Eli Zaretskii
<eliz@gnu.org>
10/1
----
lib/readline/vi_mode.c
- rl_vi_start_inserting: start an undo group so we can grab the text
inserted here as a single unit, avoiding any insert coalescing
performed by rl_insert_text. Report and fix from Richard Todd
<richard.w.todd@outlook.com>
10/3
----
subst.c
- parameter_brace_transform: if we're asked to display the attributes
of an unset variable, check that the variable exists even if
get_var_and_type returns NULL (it checks invisible_p). Requested by
Michal Pesa <pesathem@gmail.com>
lib/readline/kill.c
- _rl_bracketed_text: new function, collects the text pasted in
bracketed paste mode and consumes the bracketed paste end marker;
returns the pasted text and its length
- rl_bracketed_paste_begin: call _rl_bracketed_text to collect the
text
lib/readline/isearch.c
- _rl_isearch_dispatch: set cxt->lastc to -7 if the input resolves to
rl_bracketed_paste_begin
- _rl_isearch_dispatch: if cxt->lastc == -7, call _rl_bracketed_text
to collect the pasted text and add it to the accumulating search
string. Only works if ESC is not one of the isearch terminators.
Fixes issue reported in Debian bug report 891780,
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891780
10/5
----
variables.c
- push_posix_tempvar_internal: new function, body of push_func_var
with additional argument saying whether it's being called from a
function or (special) builtin code path
- push_builtin_var: new function, calls push_posix_tempvar_internal
with second argument indicating builtin code path
- push_func_var: now a stub that calls push_posix_tempvar_internal
with second argument indicating function code path
- pop_scope: if called from a special builtin, call push_builtin_var
instead of push_func_var to do the right variable propagation
builtins/shopt.def
- progcomp_alias: uncomment, make available to users
doc/{bash.1,bashref.texi},lib/readline/doc/rluser.texi
- progcomp_alias: document shopt option, describe its use in
the section on programmable completion
trap.c
- decode_signal: handle SIGRTMIN+n at runtime, with the `SIG' prefix
or without, case-insensitively if requested, and return SIGRTMIN+n.
These values could be different than what was available at compile
time. Report and patch from Rasmus Villemoes <rv@rasumsvillemoes.dk>
10/8
----
execute_cmd.c
- execute_command_internal: only set line_number from command->value.Subshell
if the type == cm_subshell; otherwise defer and set later
10/10
-----
examples/loadables/seq.c
- seq: new loadable builtin, derived originally from coreutils:seq.c
but with very little of that code remaining
10/12
-----
trap.c
- run_pending_traps,_run_trap_internal: honor evalnest_max and
increment/decrement evalnest accordingly, since trap actions
are processed as if run by `eval'. Feature suggsted by Mike
Gerwitz <mtg@gnu.org>
10/16
-----
expr.c
- expr_skipsubscript: new function, calls skipsubscript with flags
similar to arrayfunc.c:valid_array_subscript if assoc_expand_once
is set and it looks like we've already expanded the subscript of
an associative array. Reported back on 8/27 by Grisha Levit
<grishalevit@gmail.com>
- readtok: call expr_skipsubscript instead of skipsubscript
arrayfunc.c
- valid_array_reference: call skipsubscript with a third arg computed
from the VA_NOEXPAND flag only if we're expanding an associative
array subscript -- we already figure out whether or not we are
[bumped release status to beta2]
10/20
-----
builtins/setattr.def
- set_or_show_attributes: after isolating NAME, make sure to restore
the "[+]=" in case we need the word later. Issue pointed out by
Grisha Levit <grishalevit@gmail.com>
10/21
-----
lib/readline/search.c
- noninc_search_from_pos: if we are supposed to be searching for a
pattern (vi mode), make sure to pass S to _hs_history_patsearch,
since that has any leading `^' stripped
lib/readline/histsearch.c
- _hs_history_patsearch: if the search isn't anchored, put a `*' at
the beginning to force fnmatch to match anywhere in the line (could
look at this later to make a change to history_search_internal that
would avoid the need to add the leading `*')
subst.c
- parameter_brace_expand_rhs: treat a failure to assign a variable with
a ${param:=value} expansion as an expansion error, and, in a non-
interactive posix-mode shell, exit the shell
- param_expand: don't set W_SPLITSPACE for $* unless IFS is NULL;
consistent with other uses of W_SPLITSPACE
10/22
-----
doc/{bash.1,bashref.texi}
- tweak description of bash conditional expressions to note that the
test and [ commands determine their behavior based on the number of
arguments. Suggested by Ilkka Virta <itvirta@iki.fi>
10/24
-----
execute_cmd.c
- execute_simple_command: don't set $_ to NULL when executing a
command that forks; just leave it unchanged. Tweaked the documentation
slightly as a result. Inspired by report from Ricky Tigg
<ricky.tigg@gmail.com>
10/28
-----
redir.c
- here_document_to_fd: make sure the temp files used to store here
documents are readable (and writable, where necessary) by the user.
This can happen in the unlikely case that someone decides to shoot
himself in the foot by setting the umask to 400. Issue originally
raised back in March by Stephane Chazelas
<stephane.chazelas@gmail.com>; fix inspired by Martijn Dekker
<martijn@inlv.org>
10/29
-----
lib/readline/terminal.c
- bind_termcap_arrow_keys: bind the "kI" capability (what the Insert
keypad key outputs) to overwrite mode. Patch from Xose Vazquez Perez
<xose.vazquez@gmail.com>
10/30
-----
braces.c
- mkseq: make sure to terminate result array before passing it to
strvec_dispose on an interrupt. Report and fix from Corbin Souffrant
<corbin.souffrant@gmail.com>
11/6
----
trap.c
- _run_trap_internal: if the signal shows up as SIG_CHANGED after
running the trap handler, check for terminating signals and run any
terminating signal handler indicates. Fixes issue reported by
Owen Stephens <owen@owenstephens.co.uk>
11/7
----
execute_cmd.c
- execute_builtin: don't merge the temporary environment when the
`return' builtin is being executed if it's being executed by the
`command' builtin, since that's supposed to inhibit the special
builtin properties. Part of POSIX conformance problems reported
by Martin Rehak <martin.rehak@oracle.com>
builtins/cd.def
- bindpwd: if canonicalization fails when -P is specified (e.g. if the
directory name length exceeds PATH_MAX), reset dirname ($PWD value) =
to the_current_working_directory (Posix cd description, step 10.)
Part of POSIX conformance problems reported by Martin Rehak
<martin.rehak@oracle.com>
builtins/kill.def
- kill_builtin: support -sSIG and -nSIG without requiring them to be
separate arguments. POSIX says a "conforming implementation" should
accept them.
Part of POSIX conformance problems reported by Martin Rehak
<martin.rehak@oracle.com>
11/8
----
arrayfunc.c
- array_value_internal: return NULL for invisible array variables.
Fixes issue with FUNCNAME sometimes returning invalid value reported
by Great Big Dot <greatbigdot@gmail.com>
builtins/cd.def
- change_to_directory: if we are in posix mode, and the chdir to the
absolute pathname ($PWD/dirname) fails, return an error without
trying to use just `dirname' (posix cd step 10).
Part of POSIX conformance problems reported by Martin Rehak
<martin.rehak@oracle.com>
execute_cmd.c
- execute_case_command: use expand_word_leave_quoted to expand the
word, then dequote the resulting string. This performs the
expansions in the order posix specifies.
Part of POSIX conformance problems reported by Martin Rehak
<martin.rehak@oracle.com>
subst.c
- expand_word_unsplit: rewrite in terms of expand_word_leave_quoted
- ifs_whitespace: new macro, Posix ifs whitespace (ISSPACE; member
of current locale's space char class)
- ifs_whitesep: new macro, whitespace that is a member of $IFS; used
by list_string and get_word_from_string
- list_string: use ifs_whitesep instead of spctabnl in case $IFS
contains whitespace characters that are not space, tab, or newline
- get_word_from_string: use ifs_whitesep instead of spctabnl in case
$IFS contains whitespace characters that are not space, tab, or
newline.
Part of POSIX conformance problems reported by Martin Rehak
<martin.rehak@oracle.com>
11/9
----
general.c
- posix_initialize: enable the shift_verbose option when turning on
posix mode, and disable it when posix mode is disabled. From a
report by Eric Blake <eblake@redhat.com>
doc/bashref.texi
- posix mode: note the effect of posix mode on shift_verbose
11/12
-----
subst.c
- parameter_brace_expand: if parameter_brace_expand_word returns an
error, make sure to set TEMP = 0 (to note that the variable is unset).
From a report by Grisha Levit <grishalevit@gmail.com>
- param_expand: if expanding $! when set -u is enabled, honor the
PF_IGNUNBOUND flag and just return NULL, relying on the caller to
take care of understanding that the variable is unset
From a report by Grisha Levit <grishalevit@gmail.com>
- parameter_brace_expand: if we are checking nullness, and we have a
valid array expansion, a quoted null string resulting from the array
expansion of a * or @ subscript satisfies the nullness check.
From a report by Grisha Levit <grishalevit@gmail.com>
11/14
-----
aclocal.m4
- BASH_CHECK_LIB_TERMCAP: add last-ditch check for libncursesw, since
it's apparently the only curses library on some distributions.
Report from John Frankish <john.frankish@outlook.com>
11/16
-----
bashline.c
- attempt_shell_completion: allow an initial word completion to
complete a partial first word (point appears in the middle of
the word) before resorting to command completion. Report and fix
from Luca Boccassi <bluca@debian.org>
[bash-5.0-beta2 frozen]
+3
View File
@@ -675,6 +675,7 @@ examples/loadables/necho.c f
examples/loadables/hello.c f
examples/loadables/print.c f
examples/loadables/realpath.c f
examples/loadables/seq.c f
examples/loadables/setpgid.c f
examples/loadables/sleep.c f
examples/loadables/strftime.c f
@@ -870,6 +871,7 @@ tests/array23.sub f
tests/array24.sub f
tests/array25.sub f
tests/array26.sub f
tests/array27.sub f
tests/array-at-star f
tests/array2.right f
tests/assoc.tests f
@@ -910,6 +912,7 @@ tests/case.right f
tests/case1.sub f
tests/case2.sub f
tests/case3.sub f
tests/case4.sub f
tests/casemod.tests f
tests/casemod.right f
tests/comsub.tests f
+30
View File
@@ -110,6 +110,30 @@ gg. The localvar_inherit option will not attempt to inherit a value from a
hh. The `globasciiranges' option is now enabled by default; it can be set to
off by default at configuration time.
ii. Associative and indexed arrays now allow subscripts consisting solely of
whitespace.
jj. `checkwinsize' is now enabled by default.
kk. The `localvar_unset' shopt option is now visible and documented.
ll. The `progcomp_alias' shopt option is now visible and documented.
mm. The signal name processing code now understands `SIGRTMIN+n' all the way
up to SIGRTMAX.
nn. There is a new `seq' loadable builtin.
oo. Trap execution now honors the (internal) max invocations of `eval', since
traps are supposed to be executed as if using `eval'.
pp. The $_ variable doesn't change when the shell executes a command that forks.
qq. The `kill' builtin now supports -sSIGNAME and -nSIGNUM, even though
conforming applications aren't supposed to use them.
rr. POSIX mode now enables the `shift_verbose' option.
2. New Features in Readline
a. Non-incremental vi-mode search (`N', `n') can search for a shell pattern, as
@@ -145,6 +169,12 @@ i. The history library has a new variable that allows applications to set the
initial quoting state, so quoting state can be inherited from a previous
line.
j. Readline now allows application-defined keymap names; there is a new public
function, rl_set_keymap_name(), to do that.
k. The "Insert" keypad key, if available, now puts readline into overwrite
mode.
-------------------------------------------------------------------------------
This is a terse description of the new features added to bash-4.4 since
the release of bash-4.3. As always, the manual page (doc/bash.1) is
+24 -14
View File
@@ -169,56 +169,66 @@ The following list is what's changed when 'POSIX mode' is in effect:
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
44. When the 'alias' builtin displays alias definitions, it does not
44. 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
display them with a leading 'alias ' unless the '-p' option is
supplied.
45. When the 'set' builtin is invoked without options, it does not
46. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
46. When the 'set' builtin is invoked without options, it displays
47. 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.
47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
48. 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.
48. The 'pwd' builtin verifies that the value it prints is the same as
49. 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
the current directory, even if it is not asked to check the file
system with the '-P' option.
49. When listing the history, the 'fc' builtin does not include an
51. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
50. The default editor used by 'fc' is 'ed'.
52. The default editor used by 'fc' is 'ed'.
51. The 'type' and 'command' builtins will not report a non-executable
53. 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'.
52. The 'vi' editing mode will invoke the 'vi' editor directly when
54. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
53. When the 'xpg_echo' option is enabled, Bash does not attempt to
55. 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.
54. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
55. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
57. 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.
56. The 'read' builtin may be interrupted by a signal for which a trap
58. 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.
57. Bash removes an exited background process's status from the list
59. 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
+3 -2
View File
@@ -962,7 +962,8 @@ AC_CACHE_VAL(bash_cv_termcap_lib,
[AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
[AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
[AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
bash_cv_termcap_lib=gnutermcap)])])])])])
[AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw,
bash_cv_termcap_lib=gnutermcap)])])])])])])
if test "X$_bash_needmsg" = "Xyes"; then
AC_MSG_CHECKING(which library has the termcap functions)
fi
@@ -1852,7 +1853,7 @@ main()
],
ac_cv_rl_version=`cat conftest.rlv`,
ac_cv_rl_version='0.0',
ac_cv_rl_version='7.0')])
ac_cv_rl_version='8.0')])
CFLAGS="$_save_CFLAGS"
LDFLAGS="$_save_LDFLAGS"
+34 -14
View File
@@ -283,7 +283,7 @@ assign_array_element (name, value, flags)
int flags;
{
char *sub, *vname;
int sublen;
int sublen, isassoc;
SHELL_VAR *entry;
vname = array_variable_name (name, (flags & ASS_NOEXPAND) != 0, &sub, &sublen);
@@ -291,14 +291,16 @@ assign_array_element (name, value, flags)
if (vname == 0)
return ((SHELL_VAR *)NULL);
if ((ALL_ELEMENT_SUB (sub[0]) && sub[1] == ']') || (sublen <= 1))
entry = find_variable (vname);
isassoc = entry && assoc_p (entry);
if (((isassoc == 0 || (flags & ASS_NOEXPAND) == 0) && (ALL_ELEMENT_SUB (sub[0]) && sub[1] == ']')) || (sublen <= 1))
{
free (vname);
err_badarraysub (name);
return ((SHELL_VAR *)NULL);
}
entry = find_variable (vname);
entry = assign_array_element_internal (entry, name, vname, sub, sublen, value, flags);
free (vname);
@@ -777,7 +779,7 @@ unbind_array_element (var, sub, flags)
char *akey;
ARRAY_ELEMENT *ae;
len = skipsubscript (sub, 0, (flags&1) || (var && assoc_p(var)));
len = skipsubscript (sub, 0, (flags&1) || (var && assoc_p(var))); /* XXX */
if (sub[len] != ']' || len == 0)
{
builtin_error ("%s[%s: %s", var->name, sub, _(bash_badsub_errmsg));
@@ -888,31 +890,43 @@ print_assoc_assignment (var, quoted)
/***********************************************************************/
/* Return 1 if NAME is a properly-formed array reference v[sub]. */
/* We need to reserve 1 for FLAGS, which we pass to skipsubscript. */
int
valid_array_reference (name, flags)
const char *name;
int flags;
{
char *t;
int r, len;
int r, len, isassoc;
SHELL_VAR *entry;
t = mbschr (name, '['); /* ] */
isassoc = 0;
if (t)
{
*t = '\0';
r = legal_identifier (name);
if (flags & VA_NOEXPAND) /* Don't waste a lookup if we don't need one */
isassoc = (entry = find_variable (name)) && assoc_p (entry);
*t = '[';
if (r == 0)
return 0;
/* Check for a properly-terminated non-null subscript. */
len = skipsubscript (t, 0, flags);
if (t[len] != ']' || len == 1)
if (isassoc && ((flags & (VA_NOEXPAND|VA_ONEWORD)) == (VA_NOEXPAND|VA_ONEWORD)))
len = strlen (t) - 1;
else if (isassoc)
len = skipsubscript (t, 0, flags&VA_NOEXPAND); /* VA_NOEXPAND must be 1 */
else
/* Check for a properly-terminated non-null subscript. */
len = skipsubscript (t, 0, 0); /* arithmetic expression */
if (t[len] != ']' || len == 1 || t[len+1] != '\0')
return 0;
if (t[len+1] != '\0')
return 0;
#if 1
#if 0
/* Could check and allow subscripts consisting only of whitespace for
existing associative arrays. */
existing associative arrays, using isassoc */
for (r = 1; r < len; r++)
if (whitespace (t[r]) == 0)
return 1;
@@ -940,7 +954,7 @@ array_expand_index (var, s, len, flags)
exp = (char *)xmalloc (len);
strncpy (exp, s, len - 1);
exp[len - 1] = '\0';
#if 0 /* XXX - not yet -- maybe bash-5.0 */
#if 0 /* XXX - not yet -- maybe bash-5.1 */
if ((flags & AV_NOEXPAND) == 0)
t = expand_arith_string (exp, Q_DOUBLE_QUOTES|Q_ARITH|Q_ARRAYSUB); /* XXX - Q_ARRAYSUB for future use */
else
@@ -1093,6 +1107,8 @@ array_value_internal (s, quoted, flags, rtype, indp)
}
else if (var == 0 || value_cell (var) == 0) /* XXX - check for invisible_p(var) ? */
return ((char *)NULL);
else if (invisible_p (var))
return ((char *)NULL);
else if (array_p (var) == 0 && assoc_p (var) == 0)
l = add_string_to_list (value_cell (var), (WORD_LIST *)NULL);
else if (assoc_p (var))
@@ -1117,7 +1133,6 @@ array_value_internal (s, quoted, flags, rtype, indp)
free (temp);
}
else /* ${name[@]} or unquoted ${name[*]} */
/* XXX - bash-4.4/bash-5.0 test AV_ASSIGNRHS and pass PF_ASSIGNRHS */
retval = string_list_dollar_at (l, quoted, (flags & AV_ASSIGNRHS) ? PF_ASSIGNRHS : 0);
dispose_words (l);
@@ -1165,6 +1180,11 @@ array_value_internal (s, quoted, flags, rtype, indp)
FREE (akey);
return ((char *)NULL);
}
else if (invisible_p (var))
{
FREE (akey);
return ((char *)NULL);
}
if (array_p (var) == 0 && assoc_p (var) == 0)
return (ind == 0 ? value_cell (var) : (char *)NULL);
else if (assoc_p (var))
+6
View File
@@ -40,6 +40,10 @@ extern int array_expand_once;
#define AV_ASSIGNRHS 0x010 /* no splitting, special case ${a[@]} */
#define AV_NOEXPAND 0x020 /* don't run assoc subscripts through word expansion */
/* Flags for valid_array_reference. Value 1 is reserved for skipsubscript() */
#define VA_NOEXPAND 0x001
#define VA_ONEWORD 0x002
extern SHELL_VAR *convert_var_to_array __P((SHELL_VAR *));
extern SHELL_VAR *convert_var_to_assoc __P((SHELL_VAR *));
@@ -83,6 +87,8 @@ extern SHELL_VAR *array_variable_part __P((const char *, int, char **, int *));
#define AV_USEIND 0
#define AV_ASSIGNRHS 0
#define VA_ONEWORD 0
#endif
#endif /* !_ARRAYFUNC_H_ */
+4 -1
View File
@@ -31,9 +31,12 @@
#define HC_IGNBOTH (HC_IGNSPACE|HC_IGNDUPS)
#if defined (STRICT_POSIX)
# undef HISTEXPAND_DEFAULT
# define HISTEXPAND_DEFAULT 0
#else
# define HISTEXPAND_DEFAULT 1
# if !defined (HISTEXPAND_DEFAULT)
# define HISTEXPAND_DEFAULT 1
# endif /* !HISTEXPAND_DEFAULT */
#endif
extern int remember_on_history;
+25 -2
View File
@@ -1581,7 +1581,9 @@ attempt_shell_completion (text, start, end)
{
prog_complete_matches = programmable_completions (n, text, s, e, &foundcs);
/* command completion if programmable completion fails */
in_command_position = s == start && STREQ (n, text); /* XXX */
/* If we have a completion for the initial word, we can prefer that */
in_command_position = s == start && (iw_compspec || STREQ (n, text)); /* XXX */
foundcs = foundcs && (iw_compspec == 0);
}
/* empty command name following command separator */
else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0 &&
@@ -2988,7 +2990,7 @@ restore_tilde (val, directory_part)
char *val, *directory_part;
{
int l, vl, dl2, xl;
char *dh2, *expdir, *ret;
char *dh2, *expdir, *ret, *v;
vl = strlen (val);
@@ -3000,6 +3002,22 @@ restore_tilde (val, directory_part)
expdir = bash_tilde_expand (directory_part, 0);
xl = strlen (expdir);
if (*directory_part == '~' && STREQ (directory_part, expdir))
{
/* tilde expansion failed, so what should we return? we use what the
user typed. */
v = mbschr (val, '/');
vl = STRLEN (v);
ret = (char *)xmalloc (xl + vl + 2);
strcpy (ret, directory_part);
if (v && *v)
strcpy (ret + xl, v);
free (dh2);
free (expdir);
return ret;
}
free (expdir);
/*
@@ -3010,6 +3028,11 @@ restore_tilde (val, directory_part)
l = length of remainder after tilde-prefix
*/
l = (vl - xl) + 1;
if (l <= 0)
{
free (dh2);
return (savestring (val)); /* XXX - just punt */
}
ret = (char *)xmalloc (dl2 + 2 + l);
strcpy (ret, dh2);
+1
View File
@@ -438,6 +438,7 @@ mkseq (start, end, incr, type, width)
#if defined (SHELL)
if (ISINTERRUPT)
{
result[i] = (char *)NULL;
strvec_dispose (result);
result = (char **)NULL;
}
+16 -4
View File
@@ -138,7 +138,7 @@ bindpwd (no_symlinks)
int no_symlinks;
{
char *dirname, *pwdvar;
int old_anm, r;
int old_anm, r, canon_failed;
SHELL_VAR *tvar;
r = sh_chkwrite (EXECUTION_SUCCESS);
@@ -148,6 +148,13 @@ bindpwd (no_symlinks)
: get_working_directory ("cd");
#undef tcwd
/* If canonicalization fails, reset dirname to the_current_working_directory */
if (dirname == 0)
{
canon_failed = 1;
dirname = the_current_working_directory;
}
old_anm = array_needs_making;
pwdvar = get_string_value ("PWD");
@@ -163,7 +170,7 @@ bindpwd (no_symlinks)
if (setpwd (dirname) == EXECUTION_FAILURE)
r = EXECUTION_FAILURE;
if (dirname == 0 && eflag)
if (canon_failed && eflag)
r = EXECUTION_FAILURE;
if (dirname && dirname != the_current_working_directory)
@@ -580,7 +587,11 @@ change_to_directory (newdir, nolinks, xattr)
/* In POSIX mode, if we're resolving symlinks logically and sh_canonpath
returns NULL (because it checks the path, it will return NULL if the
resolved path doesn't exist), fail immediately. */
#if defined (ENAMETOOLONG)
if (posixly_correct && nolinks == 0 && canon_failed && (errno != ENAMETOOLONG || ndlen > PATH_MAX))
#else
if (posixly_correct && nolinks == 0 && canon_failed && ndlen > PATH_MAX)
#endif
{
#if defined ENAMETOOLONG
if (errno != ENOENT && errno != ENAMETOOLONG)
@@ -650,8 +661,9 @@ change_to_directory (newdir, nolinks, xattr)
/* We're not in physical mode (nolinks == 0), but we failed to change to
the canonicalized directory name (TDIR). Try what the user passed
verbatim. If we succeed, reinitialize the_current_working_directory. */
if (chdir (newdir) == 0)
verbatim. If we succeed, reinitialize the_current_working_directory.
POSIX requires that we just fail here, so we do in posix mode. */
if (posixly_correct == 0 && chdir (newdir) == 0)
{
t = resetpwd ("cd");
if (t == 0)
+3
View File
@@ -230,6 +230,9 @@ extern int loop_level;
/* variables from read.def */
extern int sigalrm_seen;
/* variables from shift.def */
extern int print_shift_error;
/* variables from source.def */
extern int source_searches_cwd;
extern int source_uses_path;
+6
View File
@@ -68,6 +68,7 @@ $END
#endif
#include "common.h"
#include "bashgetopt.h"
#include "input.h"
/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
#if !defined (errno)
@@ -221,6 +222,11 @@ exec_builtin (list)
default_tty_job_signals (); /* undo initialize_job_signals */
#endif /* JOB_CONTROL */
#if defined (BUFFERED_INPUT)
if (default_buffered_input >= 0)
sync_buffered_stream (default_buffered_input);
#endif
exit_value = shell_execve (command, args, env);
/* We have to set this to NULL because shell_execve has called realloc()
+1
View File
@@ -419,6 +419,7 @@ fc_builtin (list)
{
sh_wrerror ();
fclose (stream);
FREE (fn);
return (EXECUTION_FAILURE);
}
fclose (stream);
+11
View File
@@ -118,6 +118,7 @@ kill_builtin (list)
if (list)
{
sigspec = list->word->word;
use_sigspec:
if (sigspec[0] == '0' && sigspec[1] == '\0')
sig = 0;
else
@@ -131,6 +132,16 @@ kill_builtin (list)
return (EXECUTION_FAILURE);
}
}
else if (word[0] == '-' && word[1] == 's' && ISALPHA (word[2]))
{
sigspec = word + 2;
goto use_sigspec;
}
else if (word[0] == '-' && word[1] == 'n' && ISDIGIT (word[2]))
{
sigspec = word + 2;
goto use_sigspec;
}
else if (ISOPTION (word, '-'))
{
list = list->next;
+6 -2
View File
@@ -247,6 +247,9 @@ printf_builtin (list)
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
int mbind, mblen;
#endif
#if defined (ARRAY_VARS)
int arrayflags;
#endif
conversion_error = 0;
retval = EXECUTION_SUCCESS;
@@ -261,7 +264,8 @@ printf_builtin (list)
case 'v':
vname = list_optarg;
#if defined (ARRAY_VARS)
if (legal_identifier (vname) || valid_array_reference (vname, assoc_expand_once))
arrayflags = assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0;
if (legal_identifier (vname) || valid_array_reference (vname, arrayflags))
#else
if (legal_identifier (vname))
#endif
@@ -1277,7 +1281,7 @@ bind_printf_variable (name, value, flags)
SHELL_VAR *v;
#if defined (ARRAY_VARS)
if (valid_array_reference (name, assoc_expand_once) == 0)
if (valid_array_reference (name, assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0) == 0)
v = bind_variable (name, value, flags);
else
v = assign_array_element (name, value, flags | (assoc_expand_once ? ASS_NOEXPAND : 0));
+8 -5
View File
@@ -179,7 +179,8 @@ read_builtin (list)
int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2, nflag;
volatile int i;
int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;
int raw, edit, nchars, silent, have_timeout, ignore_delim, fd;
int lastsig, t_errno;
int mb_cur_max;
unsigned int tmsec, tmusec;
long ival, uval;
@@ -192,6 +193,7 @@ read_builtin (list)
TTYSTRUCT ttattrs, ttset;
#if defined (ARRAY_VARS)
WORD_LIST *alist;
int vflags;
#endif
#if defined (READLINE)
char *rlbuf, *itext;
@@ -336,7 +338,8 @@ read_builtin (list)
/* Convenience: check early whether or not the first of possibly several
variable names is a valid identifier, and bail early if so. */
#if defined (ARRAY_VARS)
if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, assoc_expand_once) == 0)
vflags = assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0;
if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, vflags) == 0)
#else
if (list && legal_identifier (list->word->word) == 0)
#endif
@@ -853,7 +856,7 @@ assign_vars:
{
varname = list->word->word;
#if defined (ARRAY_VARS)
if (legal_identifier (varname) == 0 && valid_array_reference (varname, assoc_expand_once) == 0)
if (legal_identifier (varname) == 0 && valid_array_reference (varname, vflags) == 0)
#else
if (legal_identifier (varname) == 0)
#endif
@@ -901,7 +904,7 @@ assign_vars:
/* Now assign the rest of the line to the last variable argument. */
#if defined (ARRAY_VARS)
if (legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, assoc_expand_once) == 0)
if (legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, vflags) == 0)
#else
if (legal_identifier (list->word->word) == 0)
#endif
@@ -964,7 +967,7 @@ bind_read_variable (name, value)
SHELL_VAR *v;
#if defined (ARRAY_VARS)
if (valid_array_reference (name, assoc_expand_once) == 0)
if (valid_array_reference (name, assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0) == 0)
v = bind_variable (name, value, 0);
else
v = assign_array_element (name, value, assoc_expand_once ? ASS_NOEXPAND : 0);
+9 -4
View File
@@ -800,7 +800,7 @@ unset_builtin (list)
WORD_LIST *list;
{
int unset_function, unset_variable, unset_array, opt, nameref, any_failed;
int global_unset_func, global_unset_var;
int global_unset_func, global_unset_var, vflags;
char *name, *tname;
unset_function = unset_variable = unset_array = nameref = any_failed = 0;
@@ -837,6 +837,10 @@ unset_builtin (list)
else if (unset_function && nameref)
nameref = 0;
#if defined (ARRAY_VARS)
vflags = assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0;
#endif
while (list)
{
SHELL_VAR *var;
@@ -852,7 +856,8 @@ unset_builtin (list)
#if defined (ARRAY_VARS)
unset_array = 0;
if (!unset_function && nameref == 0 && valid_array_reference (name, assoc_expand_once)) /* XXX valid array reference second arg was 0 */
/* XXX valid array reference second arg was 0 */
if (!unset_function && nameref == 0 && valid_array_reference (name, vflags))
{
t = strchr (name, '[');
*t++ = '\0';
@@ -909,7 +914,7 @@ unset_builtin (list)
if (var && unset_array)
{
/* Let unbind_array_element decide what to do with non-array vars */
tem = unbind_array_element (var, t, assoc_expand_once); /* XXX new third arg */
tem = unbind_array_element (var, t, vflags); /* XXX new third arg */
if (tem == -2 && array_p (var) == 0 && assoc_p (var) == 0)
{
builtin_error (_("%s: not an array variable"), var->name);
@@ -932,7 +937,7 @@ unset_builtin (list)
{
tname = savestring (nameref_cell (var));
if (var = array_variable_part (tname, 0, &t, (int *)0))
tem = unbind_array_element (var, t, assoc_expand_once); /* XXX new third arg */
tem = unbind_array_element (var, t, vflags); /* XXX new third arg */
free (tname);
}
else
+7 -1
View File
@@ -277,6 +277,12 @@ set_or_show_attributes (list, attribute, nodefs)
}
set_var_attribute (name, attribute, undo);
if (assign) /* restore word */
{
name[assign] = '=';
if (aflags & ASS_APPEND)
name[assign-1] = '+';
}
list = list->next;
}
}
@@ -504,7 +510,7 @@ show_name_attributes (name, nodefs)
var = find_variable_noref (name);
#endif
if (var /* && invisible_p (var) == 0 */) /* XXX bash-4.4/bash-5.0 */
if (var /* && invisible_p (var) == 0 */)
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
return (0);
+2 -4
View File
@@ -1,7 +1,7 @@
This file is shopt.def, from which is created shopt.c.
It implements the Bash `shopt' builtin.
Copyright (C) 1994-2016 Free Software Foundation, Inc.
Copyright (C) 1994-2018 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -220,9 +220,7 @@ static struct {
{ "lithist", &literal_history, (shopt_set_func_t *)NULL },
#endif
{ "localvar_inherit", &localvar_inherit, (shopt_set_func_t *)NULL },
#if 0 /* bash-5.0-beta */
{ "localvar_unset", &localvar_unset, (shopt_set_func_t *)NULL },
#endif
{ "login_shell", &shopt_login_shell, set_login_shell },
{ "mailwarn", &mail_warning, (shopt_set_func_t *)NULL },
#if defined (READLINE)
@@ -233,7 +231,7 @@ static struct {
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
#if defined (PROGRAMMABLE_COMPLETION)
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
# if 0 /* bash-5.0-beta */
# if defined (ALIAS)
{ "progcomp_alias", &progcomp_alias, (shopt_set_func_t *)NULL },
# endif
#endif
+8 -2
View File
@@ -142,7 +142,7 @@
/* Define to 0 if you want the checkwinsize option off by default, 1 if you
want it on. */
#define CHECKWINSIZE_DEFAULT 0
#define CHECKWINSIZE_DEFAULT 1
/* Define to 1 if you want to optimize for sequential array assignment when
using indexed arrays, 0 if you want bash-4.2 behavior, which favors
@@ -161,7 +161,8 @@
no longer exists. This behavior is the default in Posix mode. */
#define CHECKHASH_DEFAULT 0
/* Define to the maximum level of recursion you want for the eval builtin.
/* Define to the maximum level of recursion you want for the eval builtin
and trap handlers (since traps are run as if run by eval).
0 means the limit is not active. */
#define EVALNEST_MAX 0
@@ -180,3 +181,8 @@
/* Define to set the initial size of the history list ($HISTSIZE). This must
be a string. */
/*#define HISTSIZE_DEFAULT "500"*/
/* Define to 0 if you want history expansion to be disabled by default in
interactive shells; define to 1 for the historical behavior of enabling
when the shell is interactive. */
#define HISTEXPAND_DEFAULT 1
Vendored
+95 -13
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.0, version 5.002.
# From configure.ac for Bash 5.0, version 5.003.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bash 5.0-beta.
# Generated by GNU Autoconf 2.69 for bash 5.0-beta2.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.0-beta'
PACKAGE_STRING='bash 5.0-beta'
PACKAGE_VERSION='5.0-beta2'
PACKAGE_STRING='bash 5.0-beta2'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1394,7 +1394,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.0-beta to adapt to many kinds of systems.
\`configure' configures bash 5.0-beta2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1459,7 +1459,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.0-beta:";;
short | recursive ) echo "Configuration of bash 5.0-beta2:";;
esac
cat <<\_ACEOF
@@ -1655,7 +1655,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.0-beta
bash configure 5.0-beta2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2364,7 +2364,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.0-beta, which was
It was created by bash $as_me 5.0-beta2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2759,7 +2759,7 @@ ac_config_headers="$ac_config_headers config.h"
BASHVERS=5.0
RELSTATUS=beta
RELSTATUS=beta2
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -5222,6 +5222,45 @@ fi
$as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then :
bash_cv_termcap_lib=libncurses
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5
$as_echo_n "checking for tgetent in -lncursesw... " >&6; }
if ${ac_cv_lib_ncursesw_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lncursesw $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ncursesw_tgetent=yes
else
ac_cv_lib_ncursesw_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5
$as_echo "$ac_cv_lib_ncursesw_tgetent" >&6; }
if test "x$ac_cv_lib_ncursesw_tgetent" = xyes; then :
bash_cv_termcap_lib=libncursesw
else
bash_cv_termcap_lib=gnutermcap
fi
@@ -5236,6 +5275,8 @@ fi
fi
fi
if test "X$_bash_needmsg" = "Xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which library has the termcap functions" >&5
$as_echo_n "checking which library has the termcap functions... " >&6; }
@@ -5295,7 +5336,7 @@ if ${ac_cv_rl_version+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_rl_version='7.0'
ac_cv_rl_version='8.0'
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16001,6 +16042,45 @@ fi
$as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then :
bash_cv_termcap_lib=libncurses
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5
$as_echo_n "checking for tgetent in -lncursesw... " >&6; }
if ${ac_cv_lib_ncursesw_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lncursesw $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ncursesw_tgetent=yes
else
ac_cv_lib_ncursesw_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5
$as_echo "$ac_cv_lib_ncursesw_tgetent" >&6; }
if test "x$ac_cv_lib_ncursesw_tgetent" = xyes; then :
bash_cv_termcap_lib=libncursesw
else
bash_cv_termcap_lib=gnutermcap
fi
@@ -16015,6 +16095,8 @@ fi
fi
fi
if test "X$_bash_needmsg" = "Xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which library has the termcap functions" >&5
$as_echo_n "checking which library has the termcap functions... " >&6; }
@@ -16180,7 +16262,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
*) $as_echo "#define PGRP_PIPE 1" >>confdefs.h
;;
esac ;;
openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
*qnx[67]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
@@ -16821,7 +16903,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.0-beta, which was
This file was extended by bash $as_me 5.0-beta2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16887,7 +16969,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bash config.status 5.0-beta
bash config.status 5.0-beta2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
+3 -3
View File
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_REVISION([for Bash 5.0, version 5.002])dnl
AC_REVISION([for Bash 5.0, version 5.003])dnl
define(bashvers, 5.0)
define(relstatus, beta)
define(relstatus, beta2)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
@@ -1116,7 +1116,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1.*|2.[[0123]]*) : ;;
*) AC_DEFINE(PGRP_PIPE) ;;
esac ;;
openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
*qnx[[67]]*) LOCAL_LIBS="-lncurses" ;;
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
powerux*) LOCAL_LIBS="-lgen" ;;
+998 -977
View File
File diff suppressed because it is too large Load Diff
+32 -11
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Tue Aug 7 12:01:07 EDT 2018
.\" Last Change: Mon Oct 22 09:55:27 EDT 2018
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2018 August 7" "GNU Bash 5.0"
.TH BASH 1 "2018 October 22" "GNU Bash 5.0"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -1427,8 +1427,8 @@ as given by argument zero.
At shell startup, set to the absolute pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
Subsequently, expands to the last argument to the previous simple
command executed in the foreground, after expansion.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file
@@ -4232,9 +4232,10 @@ below).
The rules concerning the definition and use of aliases are
somewhat confusing.
.B Bash
always reads at least one complete line
of input before executing any
of the commands on that line. Aliases are expanded when a
always reads at least one complete line of input,
and all lines that make up a compound command,
before executing any of the commands on that line or the compound command.
Aliases are expanded when a
command is read, not when it is executed. Therefore, an
alias definition appearing on the same line as another
command does not take effect until the next line of input is read.
@@ -4409,12 +4410,12 @@ The levels are listed in order of decreasing precedence.
.B \fIid\fP++ \fIid\fP\-\-
variable post-increment and post-decrement
.TP
.B ++\fIid\fP \-\-\fIid\fP
variable pre-increment and pre-decrement
.TP
.B \- +
unary minus and plus
.TP
.B ++\fIid\fP \-\-\fIid\fP
variable pre-increment and pre-decrement
.TP
.B ! ~
logical and bitwise negation
.TP
@@ -4494,6 +4495,10 @@ rules above.
Conditional expressions are used by the \fB[[\fP compound command and
the \fBtest\fP and \fB[\fP builtin commands to test file attributes
and perform string and arithmetic comparisons.
The \fBtest\fP abd \fB[\fP commands determine their behavior based on
the number of arguments; see the descriptions of those commands for any
other command-specific actions.
.PP
Expressions are formed from the following unary or binary primaries.
\fBBash\fP handles several filenames specially when they are used in
expressions.
@@ -6710,6 +6715,9 @@ If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
If those searches do not result in a compspec, any compspec defined with
the \fB\-D\fP option to \fBcomplete\fP is used as the default.
If there is no default compspec, \fBbash\fP attempts alias expansion
on the command word as a final resort, and attempts to find a compspec
for the command word from any successful expansion.
.PP
Once a compspec has been found, it is used to generate the list of
matching words.
@@ -9187,7 +9195,7 @@ is displayed only if input is coming from a terminal.
.B \-r
Backslash does not act as an escape character.
The backslash is considered to be part of the line.
In particular, a backslash-newline pair may not be used as a line
In particular, a backslash-newline pair may not then be used as a line
continuation.
.TP
.B \-s
@@ -9806,6 +9814,7 @@ command and, if necessary, updates the values of
and
.SM
.BR COLUMNS .
This option is enabled by default.
.TP 8
.B cmdhist
If set,
@@ -10105,6 +10114,12 @@ If set, local variables inherit the value and attributes of a variable of
the same name that exists at a previous scope before any new value is
assigned. The nameref attribute is not inherited.
.TP 8
.B localvar_unset
If set, calling \fBunset\fP on local variables in previous function scopes
marks them so subsequent lookups find them unset until that function
returns. This is identical to the behavior of unsetting local variables
at the current function scope.
.TP 8
.B login_shell
The shell sets this option if it is started as a login shell (see
.SM
@@ -10158,6 +10173,12 @@ If set, the programmable completion facilities (see
\fBProgrammable Completion\fP above) are enabled.
This option is enabled by default.
.TP 8
.B progcomp_alias
If set, and programmable completion is enabled, \fBbash\fP treats a command
name that doesn't have any completions as a possible alias and attempts
alias expansion. If it has an alias, \fBbash\fP attempts programmable
completion using the command word resulting from the expanded alias.
.TP 8
.B promptvars
If set, prompt strings undergo
parameter expansion, command substitution, arithmetic
+37 -13
View File
@@ -3,7 +3,7 @@
</HEAD>
<BODY><TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2018 August 7<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2018 October 22<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<BR><A HREF="#index">Index</A>
@@ -1825,8 +1825,8 @@ as given by argument zero.
At shell startup, set to the absolute pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
Subsequently, expands to the last argument to the previous simple
command executed in the foreground, after expansion.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file
@@ -5402,9 +5402,10 @@ The rules concerning the definition and use of aliases are
somewhat confusing.
<B>Bash</B>
always reads at least one complete line
of input before executing any
of the commands on that line. Aliases are expanded when a
always reads at least one complete line of input,
and all lines that make up a compound command,
before executing any of the commands on that line or the compound command.
Aliases are expanded when a
command is read, not when it is executed. Therefore, an
alias definition appearing on the same line as another
command does not take effect until the next line of input is read.
@@ -5617,14 +5618,14 @@ The levels are listed in order of decreasing precedence.
<DD>
variable post-increment and post-decrement
<DT><B>++</B><I>id</I> --<I>id</I>
<DD>
variable pre-increment and pre-decrement
<DT><B>- +</B>
<DD>
unary minus and plus
<DT><B>++</B><I>id</I> --<I>id</I>
<DD>
variable pre-increment and pre-decrement
<DT><B>! ~</B>
<DD>
@@ -5726,6 +5727,11 @@ rules above.
Conditional expressions are used by the <B>[[</B> compound command and
the <B>test</B> and <B>[</B> builtin commands to test file attributes
and perform string and arithmetic comparisons.
The <B>test</B> abd <B>[</B> commands determine their behavior based on
the number of arguments; see the descriptions of those commands for any
other command-specific actions.
<P>
Expressions are formed from the following unary or binary primaries.
<B>Bash</B> handles several filenames specially when they are used in
expressions.
@@ -8569,6 +8575,9 @@ If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
If those searches do not result in a compspec, any compspec defined with
the <B>-D</B> option to <B>complete</B> is used as the default.
If there is no default compspec, <B>bash</B> attempts alias expansion
on the command word as a final resort, and attempts to find a compspec
for the command word from any successful expansion.
<P>
Once a compspec has been found, it is used to generate the list of
@@ -11625,7 +11634,7 @@ is displayed only if input is coming from a terminal.
<DD>
Backslash does not act as an escape character.
The backslash is considered to be part of the line.
In particular, a backslash-newline pair may not be used as a line
In particular, a backslash-newline pair may not then be used as a line
continuation.
<DT><B>-s</B>
@@ -12423,6 +12432,7 @@ and
<FONT SIZE=-1><B>COLUMNS</B>.
</FONT>
This option is enabled by default.
<DT><B>cmdhist</B>
<DD>
@@ -12801,6 +12811,13 @@ embedded newlines rather than using semicolon separators where possible.
If set, local variables inherit the value and attributes of a variable of
the same name that exists at a previous scope before any new value is
assigned. The nameref attribute is not inherited.
<DT><B>localvar_unset</B>
<DD>
If set, calling <B>unset</B> on local variables in previous function scopes
marks them so subsequent lookups find them unset until that function
returns. This is identical to the behavior of unsetting local variables
at the current function scope.
<DT><B>login_shell</B>
<DD>
@@ -12870,6 +12887,13 @@ to expand to a null string, rather than themselves.
If set, the programmable completion facilities (see
<B>Programmable Completion</B> above) are enabled.
This option is enabled by default.
<DT><B>progcomp_alias</B>
<DD>
If set, and programmable completion is enabled, <B>bash</B> treats a command
name that doesn't have any completions as a possible alias and attempts
alias expansion. If it has an alias, <B>bash</B> attempts programmable
completion using the command word resulting from the expanded alias.
<DT><B>promptvars</B>
<DD>
@@ -13892,7 +13916,7 @@ There may be only one active coprocess at a time.
<HR>
<TABLE WIDTH=100%>
<TR>
<TH ALIGN=LEFT width=33%>GNU Bash 5.0<TH ALIGN=CENTER width=33%>2018 August 7<TH ALIGN=RIGHT width=33%>BASH(1)
<TH ALIGN=LEFT width=33%>GNU Bash 5.0<TH ALIGN=CENTER width=33%>2018 October 22<TH ALIGN=RIGHT width=33%>BASH(1)
</TR>
</TABLE>
<HR>
@@ -13998,6 +14022,6 @@ There may be only one active coprocess at a time.
</DL>
<HR>
This document was created by man2html from bash.1.<BR>
Time: 07 September 2018 16:15:28 EDT
Time: 19 November 2018 15:21:08 EST
</BODY>
</HTML>
+224 -188
View File
@@ -2,9 +2,9 @@ This is bash.info, produced by makeinfo version 6.5 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.0, 7 August 2018).
Bash shell (version 5.0, 9 November 2018).
This is Edition 5.0, last updated 7 August 2018, of 'The GNU Bash
This is Edition 5.0, last updated 9 November 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.0, 7 August 2018). The Bash home page is
Bash shell (version 5.0, 9 November 2018). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.0, last updated 7 August 2018, of 'The GNU Bash
This is Edition 5.0, last updated 9 November 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Bash contains features that appear in other popular shells, and some
@@ -1468,10 +1468,11 @@ only be referenced; assignment to them is not allowed.
($_, an underscore.) At shell startup, set to the absolute
pathname used to invoke the shell or shell script being executed as
passed in the environment or argument list. Subsequently, expands
to the last argument to the previous command, after expansion.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command. When
checking mail, this parameter holds the name of the mail file.
to the last argument to the previous simple command executed in the
foreground, after expansion. Also set to the full pathname used to
invoke each command executed and placed in the environment exported
to that command. When checking mail, this parameter holds the name
of the mail file.

File: bash.info, Node: Shell Expansions, Next: Redirections, Prev: Shell Parameters, Up: Basic Shell Features
@@ -3201,17 +3202,21 @@ standard.
the expression is false.
3 arguments
The following conditions are applied in the order listed. If
the second argument is one of the binary conditional operators
(*note Bash Conditional Expressions::), the result of the
expression is the result of the binary test using the first
and third arguments as operands. The '-a' and '-o' operators
are considered binary operators when there are three
arguments. If the first argument is '!', the value is the
negation of the two-argument test using the second and third
arguments. If the first argument is exactly '(' and the third
argument is exactly ')', the result is the one-argument test
of the second argument. Otherwise, the expression is false.
The following conditions are applied in the order listed.
1. If the second argument is one of the binary conditional
operators (*note Bash Conditional Expressions::), the
result of the expression is the result of the binary test
using the first and third arguments as operands. The
'-a' and '-o' operators are considered binary operators
when there are three arguments.
2. If the first argument is '!', the value is the negation
of the two-argument test using the second and third
arguments.
3. If the first argument is exactly '(' and the third
argument is exactly ')', the result is the one-argument
test of the second argument.
4. Otherwise, the expression is false.
4 arguments
If the first argument is '!', the result is the negation of
@@ -3842,8 +3847,8 @@ standard.
'-r'
If this option is given, backslash does not act as an escape
character. The backslash is considered to be part of the
line. In particular, a backslash-newline pair may not be used
as a line continuation.
line. In particular, a backslash-newline pair may not then be
used as a line continuation.
'-s'
Silent mode. If input is coming from a terminal, characters
@@ -4406,7 +4411,7 @@ This builtin allows you to change additional shell optional behavior.
'checkwinsize'
If set, Bash checks the window size after each external
(non-builtin) command and, if necessary, updates the values of
'LINES' and 'COLUMNS'.
'LINES' and 'COLUMNS'. This option is enabled by default.
'cmdhist'
If set, Bash attempts to save all lines of a multiple-line
@@ -4631,6 +4636,13 @@ This builtin allows you to change additional shell optional behavior.
before any new value is assigned. The NAMEREF attribute is
not inherited.
'localvar_unset'
If set, calling 'unset' on local variables in previous
function scopes marks them so subsequent lookups find them
unset until that function returns. This is identical to the
behavior of unsetting local variables at the current function
scope.
'login_shell'
The shell sets this option if it is started as a login shell
(*note Invoking Bash::). The value may not be changed.
@@ -4665,6 +4677,13 @@ This builtin allows you to change additional shell optional behavior.
Programmable Completion::) are enabled. This option is
enabled by default.
'progcomp_alias'
If set, and programmable completion is enabled, Bash treats a
command name that doesn't have any completions as a possible
alias and attempts alias expansion. If it has an alias, Bash
attempts programmable completion using the command word
resulting from the expanded alias.
'promptvars'
If set, prompt strings undergo parameter expansion, command
substitution, arithmetic expansion, and quote removal after
@@ -5912,18 +5931,21 @@ File: bash.info, Node: Bash Conditional Expressions, Next: Shell Arithmetic,
================================
Conditional expressions are used by the '[[' compound command and the
'test' and '[' builtin commands.
'test' and '[' builtin commands. The 'test' and '[' commands determine
their behavior based on the number of arguments; see the descriptions of
those commands for any other command-specific actions.
Expressions may be unary or binary. Unary expressions are often used
to examine the status of a file. There are string operators and numeric
comparison operators as well. Bash handles several filenames specially
when they are used in expressions. If the operating system on which
Bash is running provides these special files, Bash will use them;
otherwise it will emulate them internally with this behavior: If the
FILE argument to one of the primaries is of the form '/dev/fd/N', then
file descriptor N is checked. If the FILE argument to one of the
primaries is one of '/dev/stdin', '/dev/stdout', or '/dev/stderr', file
descriptor 0, 1, or 2, respectively, is checked.
Expressions may be unary or binary, and are formed from the following
primaries. Unary expressions are often used to examine the status of a
file. There are string operators and numeric comparison operators as
well. Bash handles several filenames specially when they are used in
expressions. If the operating system on which Bash is running provides
these special files, Bash will use them; otherwise it will emulate them
internally with this behavior: If the FILE argument to one of the
primaries is of the form '/dev/fd/N', then file descriptor N is checked.
If the FILE argument to one of the primaries is one of '/dev/stdin',
'/dev/stdout', or '/dev/stderr', file descriptor 0, 1, or 2,
respectively, is checked.
When used with '[[', the '<' and '>' operators sort lexicographically
using the current locale. The 'test' command uses ASCII ordering.
@@ -6183,9 +6205,10 @@ the 'expand_aliases' shell option is set using 'shopt' (*note The Shopt
Builtin::).
The rules concerning the definition and use of aliases are somewhat
confusing. Bash always reads at least one complete line of input before
executing any of the commands on that line. Aliases are expanded when a
command is read, not when it is executed. Therefore, an alias
confusing. Bash always reads at least one complete line of input, and
all lines that make up a compound command, before executing any of the
commands on that line or the compound command. Aliases are expanded
when a command is read, not when it is executed. Therefore, an alias
definition appearing on the same line as another command does not take
effect until the next line of input is read. The commands following the
alias definition on that line are not affected by the new alias. This
@@ -6703,56 +6726,66 @@ startup files.
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
44. When the 'alias' builtin displays alias definitions, it does not
44. 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
display them with a leading 'alias ' unless the '-p' option is
supplied.
45. When the 'set' builtin is invoked without options, it does not
46. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
46. When the 'set' builtin is invoked without options, it displays
47. 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.
47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
48. 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.
48. The 'pwd' builtin verifies that the value it prints is the same as
49. 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
the current directory, even if it is not asked to check the file
system with the '-P' option.
49. When listing the history, the 'fc' builtin does not include an
51. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
50. The default editor used by 'fc' is 'ed'.
52. The default editor used by 'fc' is 'ed'.
51. The 'type' and 'command' builtins will not report a non-executable
53. 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'.
52. The 'vi' editing mode will invoke the 'vi' editor directly when
54. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
53. When the 'xpg_echo' option is enabled, Bash does not attempt to
55. 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.
54. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
55. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
57. 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.
56. The 'read' builtin may be interrupted by a signal for which a trap
58. 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.
57. Bash removes an exited background process's status from the list
59. 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
@@ -7525,13 +7558,13 @@ Variable Settings
'keymap'
Sets Readline's idea of the current keymap for key binding
commands. Acceptable 'keymap' names are 'emacs',
commands. Built-in 'keymap' names are 'emacs',
'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
'vi-command', and 'vi-insert'. 'vi' is equivalent to
'vi-command' ('vi-move' is also a synonym); 'emacs' is
equivalent to 'emacs-standard'. The default value is 'emacs'.
The value of the 'editing-mode' variable also affects the
default keymap.
equivalent to 'emacs-standard'. Applications may add
additional names. The default value is 'emacs'. The value of
the 'editing-mode' variable also affects the default keymap.
'keyseq-timeout'
Specifies the duration Readline will wait for a character when
@@ -8626,7 +8659,10 @@ command word is a full pathname, a compspec for the full pathname is
searched for first. If no compspec is found for the full pathname, an
attempt is made to find a compspec for the portion following the final
slash. If those searches do not result in a compspec, any compspec
defined with the '-D' option to 'complete' is used as the default.
defined with the '-D' option to 'complete' is used as the default. If
there is no default compspec, Bash attempts alias expansion on the
command word as a final resort, and attempts to find a compspec for the
command word from any successful expansion
Once a compspec has been found, it is used to generate the list of
matching words. If a compspec is not found, the default Bash completion
@@ -11000,17 +11036,17 @@ D.1 Index of Shell Builtin Commands
* test: Bourne Shell Builtins.
(line 269)
* times: Bourne Shell Builtins.
(line 344)
(line 348)
* trap: Bourne Shell Builtins.
(line 350)
(line 354)
* type: Bash Builtins. (line 567)
* typeset: Bash Builtins. (line 599)
* ulimit: Bash Builtins. (line 605)
* umask: Bourne Shell Builtins.
(line 399)
(line 403)
* unalias: Bash Builtins. (line 704)
* unset: Bourne Shell Builtins.
(line 417)
(line 421)
* wait: Job Control Builtins.
(line 76)
@@ -11644,134 +11680,134 @@ D.5 Concept Index

Tag Table:
Node: Top891
Node: Introduction2805
Node: What is Bash?3021
Node: What is a shell?4135
Node: Definitions6673
Node: Basic Shell Features9624
Node: Shell Syntax10843
Node: Shell Operation11869
Node: Quoting13162
Node: Escape Character14462
Node: Single Quotes14947
Node: Double Quotes15295
Node: ANSI-C Quoting16573
Node: Locale Translation17832
Node: Comments18728
Node: Shell Commands19346
Node: Simple Commands20218
Node: Pipelines20849
Node: Lists23781
Node: Compound Commands25520
Node: Looping Constructs26532
Node: Conditional Constructs29027
Node: Command Grouping40110
Node: Coprocesses41589
Node: GNU Parallel43492
Node: Shell Functions47550
Node: Shell Parameters54633
Node: Positional Parameters59046
Node: Special Parameters59946
Node: Shell Expansions63660
Node: Brace Expansion65783
Node: Tilde Expansion68507
Node: Shell Parameter Expansion71124
Node: Command Substitution85580
Node: Arithmetic Expansion86935
Node: Process Substitution87867
Node: Word Splitting88987
Node: Filename Expansion90931
Node: Pattern Matching93461
Node: Quote Removal97447
Node: Redirections97742
Node: Executing Commands107300
Node: Simple Command Expansion107970
Node: Command Search and Execution109900
Node: Command Execution Environment112276
Node: Environment115260
Node: Exit Status116919
Node: Signals118589
Node: Shell Scripts120556
Node: Shell Builtin Commands123071
Node: Bourne Shell Builtins125109
Node: Bash Builtins145767
Node: Modifying Shell Behavior174675
Node: The Set Builtin175020
Node: The Shopt Builtin185433
Node: Special Builtins202303
Node: Shell Variables203282
Node: Bourne Shell Variables203719
Node: Bash Variables205823
Node: Bash Features236283
Node: Invoking Bash237182
Node: Bash Startup Files243195
Node: Interactive Shells248298
Node: What is an Interactive Shell?248708
Node: Is this Shell Interactive?249357
Node: Interactive Shell Behavior250172
Node: Bash Conditional Expressions253659
Node: Shell Arithmetic258025
Node: Aliases260842
Node: Arrays263390
Node: The Directory Stack268756
Node: Directory Stack Builtins269540
Node: Controlling the Prompt272508
Node: The Restricted Shell275274
Node: Bash POSIX Mode277099
Node: Job Control287514
Node: Job Control Basics287974
Node: Job Control Builtins292942
Node: Job Control Variables297669
Node: Command Line Editing298825
Node: Introduction and Notation300496
Node: Readline Interaction302119
Node: Readline Bare Essentials303310
Node: Readline Movement Commands305093
Node: Readline Killing Commands306053
Node: Readline Arguments307971
Node: Searching309015
Node: Readline Init File311201
Node: Readline Init File Syntax312348
Node: Conditional Init Constructs332748
Node: Sample Init File336944
Node: Bindable Readline Commands340061
Node: Commands For Moving341265
Node: Commands For History343114
Node: Commands For Text347409
Node: Commands For Killing350797
Node: Numeric Arguments353278
Node: Commands For Completion354417
Node: Keyboard Macros358608
Node: Miscellaneous Commands359295
Node: Readline vi Mode365248
Node: Programmable Completion366155
Node: Programmable Completion Builtins373749
Node: A Programmable Completion Example384442
Node: Using History Interactively389682
Node: Bash History Facilities390366
Node: Bash History Builtins393371
Node: History Interaction397902
Node: Event Designators401522
Node: Word Designators402741
Node: Modifiers404378
Node: Installing Bash405780
Node: Basic Installation406917
Node: Compilers and Options410175
Node: Compiling For Multiple Architectures410916
Node: Installation Names412609
Node: Specifying the System Type413427
Node: Sharing Defaults414143
Node: Operation Controls414816
Node: Optional Features415774
Node: Reporting Bugs426292
Node: Major Differences From The Bourne Shell427486
Node: GNU Free Documentation License444338
Node: Indexes469515
Node: Builtin Index469969
Node: Reserved Word Index476796
Node: Variable Index479244
Node: Function Index494995
Node: Concept Index508298
Node: Top895
Node: Introduction2813
Node: What is Bash?3029
Node: What is a shell?4143
Node: Definitions6681
Node: Basic Shell Features9632
Node: Shell Syntax10851
Node: Shell Operation11877
Node: Quoting13170
Node: Escape Character14470
Node: Single Quotes14955
Node: Double Quotes15303
Node: ANSI-C Quoting16581
Node: Locale Translation17840
Node: Comments18736
Node: Shell Commands19354
Node: Simple Commands20226
Node: Pipelines20857
Node: Lists23789
Node: Compound Commands25528
Node: Looping Constructs26540
Node: Conditional Constructs29035
Node: Command Grouping40118
Node: Coprocesses41597
Node: GNU Parallel43500
Node: Shell Functions47558
Node: Shell Parameters54641
Node: Positional Parameters59054
Node: Special Parameters59954
Node: Shell Expansions63708
Node: Brace Expansion65831
Node: Tilde Expansion68555
Node: Shell Parameter Expansion71172
Node: Command Substitution85628
Node: Arithmetic Expansion86983
Node: Process Substitution87915
Node: Word Splitting89035
Node: Filename Expansion90979
Node: Pattern Matching93509
Node: Quote Removal97495
Node: Redirections97790
Node: Executing Commands107348
Node: Simple Command Expansion108018
Node: Command Search and Execution109948
Node: Command Execution Environment112324
Node: Environment115308
Node: Exit Status116967
Node: Signals118637
Node: Shell Scripts120604
Node: Shell Builtin Commands123119
Node: Bourne Shell Builtins125157
Node: Bash Builtins145907
Node: Modifying Shell Behavior174820
Node: The Set Builtin175165
Node: The Shopt Builtin185578
Node: Special Builtins203150
Node: Shell Variables204129
Node: Bourne Shell Variables204566
Node: Bash Variables206670
Node: Bash Features237130
Node: Invoking Bash238029
Node: Bash Startup Files244042
Node: Interactive Shells249145
Node: What is an Interactive Shell?249555
Node: Is this Shell Interactive?250204
Node: Interactive Shell Behavior251019
Node: Bash Conditional Expressions254506
Node: Shell Arithmetic259083
Node: Aliases261900
Node: Arrays264520
Node: The Directory Stack269886
Node: Directory Stack Builtins270670
Node: Controlling the Prompt273638
Node: The Restricted Shell276404
Node: Bash POSIX Mode278229
Node: Job Control289162
Node: Job Control Basics289622
Node: Job Control Builtins294590
Node: Job Control Variables299317
Node: Command Line Editing300473
Node: Introduction and Notation302144
Node: Readline Interaction303767
Node: Readline Bare Essentials304958
Node: Readline Movement Commands306741
Node: Readline Killing Commands307701
Node: Readline Arguments309619
Node: Searching310663
Node: Readline Init File312849
Node: Readline Init File Syntax313996
Node: Conditional Init Constructs334435
Node: Sample Init File338631
Node: Bindable Readline Commands341748
Node: Commands For Moving342952
Node: Commands For History344801
Node: Commands For Text349096
Node: Commands For Killing352484
Node: Numeric Arguments354965
Node: Commands For Completion356104
Node: Keyboard Macros360295
Node: Miscellaneous Commands360982
Node: Readline vi Mode366935
Node: Programmable Completion367842
Node: Programmable Completion Builtins375622
Node: A Programmable Completion Example386315
Node: Using History Interactively391555
Node: Bash History Facilities392239
Node: Bash History Builtins395244
Node: History Interaction399775
Node: Event Designators403395
Node: Word Designators404614
Node: Modifiers406251
Node: Installing Bash407653
Node: Basic Installation408790
Node: Compilers and Options412048
Node: Compiling For Multiple Architectures412789
Node: Installation Names414482
Node: Specifying the System Type415300
Node: Sharing Defaults416016
Node: Operation Controls416689
Node: Optional Features417647
Node: Reporting Bugs428165
Node: Major Differences From The Bourne Shell429359
Node: GNU Free Documentation License446211
Node: Indexes471388
Node: Builtin Index471842
Node: Reserved Word Index478669
Node: Variable Index481117
Node: Function Index496868
Node: Concept Index510171

End Tag Table
BIN
View File
Binary file not shown.
+2838 -2799
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+57 -19
View File
@@ -1,9 +1,9 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This text is a brief description of the features that are present in
the Bash shell (version 5.0, 7 August 2018).
the Bash shell (version 5.0, 9 November 2018).
This is Edition 5.0, last updated 7 August 2018,
This is Edition 5.0, last updated 9 November 2018,
of The GNU Bash Reference Manual,
for Bash, Version 5.0.
@@ -284,10 +284,10 @@ Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previou
<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.0, 7 August 2018).
the Bash shell (version 5.0, 9 November 2018).
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.0, last updated 7 August 2018,
<p>This is Edition 5.0, last updated 9 November 2018,
of <cite>The GNU Bash Reference Manual</cite>,
for <code>Bash</code>, Version 5.0.
</p>
@@ -2222,8 +2222,8 @@ to the filename used to invoke Bash, as given by argument zero.
At shell startup, set to the absolute pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
Subsequently, expands to the last argument to the previous simple
command executed in the foreground, after expansion.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file.
@@ -4455,19 +4455,22 @@ false.
</dd>
<dt>3 arguments</dt>
<dd><p>The following conditions are applied in the order listed.
If the second argument is one of the binary conditional
</p>
<ol>
<li> If the second argument is one of the binary conditional
operators (see <a href="#Bash-Conditional-Expressions">Bash Conditional Expressions</a>), the
result of the expression is the result of the binary test using the
first and third arguments as operands.
The &lsquo;<samp>-a</samp>&rsquo; and &lsquo;<samp>-o</samp>&rsquo; operators are considered binary operators
when there are three arguments.
If the first argument is &lsquo;<samp>!</samp>&rsquo;, the value is the negation of
</li><li> If the first argument is &lsquo;<samp>!</samp>&rsquo;, the value is the negation of
the two-argument test using the second and third arguments.
If the first argument is exactly &lsquo;<samp>(</samp>&rsquo; and the third argument is
</li><li> If the first argument is exactly &lsquo;<samp>(</samp>&rsquo; and the third argument is
exactly &lsquo;<samp>)</samp>&rsquo;, the result is the one-argument test of the second
argument.
Otherwise, the expression is false.
</p>
</li><li> Otherwise, the expression is false.
</li></ol>
</dd>
<dt>4 arguments</dt>
<dd><p>If the first argument is &lsquo;<samp>!</samp>&rsquo;, the result is the negation of
@@ -5300,7 +5303,7 @@ The prompt is displayed only if input is coming from a terminal.
<dt><code>-r</code></dt>
<dd><p>If this option is given, backslash does not act as an escape character.
The backslash is considered to be part of the line.
In particular, a backslash-newline pair may not be used as a line
In particular, a backslash-newline pair may not then be used as a line
continuation.
</p>
</dd>
@@ -6024,6 +6027,7 @@ The shell always postpones exiting if any jobs are stopped.
<dd><p>If set, Bash checks the window size after each external (non-builtin)
command and, if necessary, updates the values of
<code>LINES</code> and <code>COLUMNS</code>.
This option is enabled by default.
</p>
</dd>
<dt><code>cmdhist</code></dt>
@@ -6289,6 +6293,13 @@ the same name that exists at a previous scope before any new value is
assigned. The <var>nameref</var> attribute is not inherited.
</p>
</dd>
<dt><code>localvar_unset</code></dt>
<dd><p>If set, calling <code>unset</code> on local variables in previous function scopes
marks them so subsequent lookups find them unset until that function
returns. This is identical to the behavior of unsetting local variables
at the current function scope.
</p>
</dd>
<dt><code>login_shell</code></dt>
<dd><p>The shell sets this option if it is started as a login shell
(see <a href="#Invoking-Bash">Invoking Bash</a>).
@@ -6331,6 +6342,13 @@ files to expand to a null string, rather than themselves.
This option is enabled by default.
</p>
</dd>
<dt><code>progcomp_alias</code></dt>
<dd><p>If set, and programmable completion is enabled, Bash treats a command
name that doesn&rsquo;t have any completions as a possible alias and attempts
alias expansion. If it has an alias, Bash attempts programmable
completion using the command word resulting from the expanded alias.
</p>
</dd>
<dt><code>promptvars</code></dt>
<dd><p>If set, prompt strings undergo
parameter expansion, command substitution, arithmetic
@@ -8108,9 +8126,13 @@ Next: <a href="#Shell-Arithmetic" accesskey="n" rel="next">Shell Arithmetic</a>,
<a name="index-expressions_002c-conditional"></a>
<p>Conditional expressions are used by the <code>[[</code> compound command
and the <code>test</code> and <code>[</code> builtin commands.
and the <code>test</code> and <code>[</code> builtin commands. The <code>test</code>
and <code>[</code> commands determine their behavior based on the number
of arguments; see the descriptions of those commands for any other
command-specific actions.
</p>
<p>Expressions may be unary or binary.
<p>Expressions may be unary or binary,
and are formed from the following primaries.
Unary expressions are often used to examine the status of a file.
There are string operators and numeric comparison operators as well.
Bash handles several filenames specially when they are used in
@@ -8464,10 +8486,11 @@ unless the <code>expand_aliases</code> shell option is set using
<code>shopt</code> (see <a href="#The-Shopt-Builtin">The Shopt Builtin</a>).
</p>
<p>The rules concerning the definition and use of aliases are
somewhat confusing. Bash
always reads at least one complete line
of input before executing any
of the commands on that line. Aliases are expanded when a
somewhat confusing. Bash
always reads at least one complete line of input,
and all lines that make up a compound command,
before executing any of the commands on that line or the compound command.
Aliases are expanded when a
command is read, not when it is executed. Therefore, an
alias definition appearing on the same line as another
command does not take effect until the next line of input is read.
@@ -9113,6 +9136,11 @@ the <samp>-e</samp> option from the parent shell.
When the <code>inherit_errexit</code> option is not enabled,
Bash clears the <samp>-e</samp> option in such subshells.
</li><li> Enabling <small>POSIX</small> mode has the effect of setting the
<code>shift_verbose</code> option, so numeric arguments to <code>shift</code>
that exceed the number of positional parameters will result in an
error message.
</li><li> When the <code>alias</code> builtin displays alias definitions, it does not
display them with a leading &lsquo;<samp>alias </samp>&rsquo; unless the <samp>-p</samp> option
is supplied.
@@ -9129,6 +9157,12 @@ constructed from <code>$PWD</code> and the directory name supplied as an argumen
does not refer to an existing directory, <code>cd</code> will fail instead of
falling back to <var>physical</var> mode.
</li><li> When the <code>cd</code> builtin cannot change a directory because the
length of the pathname
constructed from <code>$PWD</code> and the directory name supplied as an argument
exceeds <var>PATH_MAX</var> when all symbolic links are expanded, <code>cd</code> will
fail instead of attempting to use only the supplied directory name.
</li><li> The <code>pwd</code> 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
<samp>-P</samp> option.
@@ -10195,7 +10229,7 @@ If this variable has not been given a value, the characters <tt class="key">ESC<
<dt><code>keymap</code></dt>
<dd><a name="index-keymap"></a>
<p>Sets Readline&rsquo;s idea of the current keymap for key binding commands.
Acceptable <code>keymap</code> names are
Built-in <code>keymap</code> names are
<code>emacs</code>,
<code>emacs-standard</code>,
<code>emacs-meta</code>,
@@ -10206,6 +10240,7 @@ Acceptable <code>keymap</code> names are
<code>vi-insert</code>.
<code>vi</code> is equivalent to <code>vi-command</code> (<code>vi-move</code> is also a
synonym); <code>emacs</code> is equivalent to <code>emacs-standard</code>.
Applications may add additional names.
The default value is <code>emacs</code>.
The value of the <code>editing-mode</code> variable also affects the
default keymap.
@@ -11840,6 +11875,9 @@ If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
If those searches do not result in a compspec, any compspec defined with
the <samp>-D</samp> option to <code>complete</code> is used as the default.
If there is no default compspec, Bash attempts alias expansion
on the command word as a final resort, and attempts to find a compspec
for the command word from any successful expansion
</p>
<p>Once a compspec has been found, it is used to generate the list of
matching words.
+224 -188
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.5 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.0, 7 August 2018).
Bash shell (version 5.0, 9 November 2018).
This is Edition 5.0, last updated 7 August 2018, of 'The GNU Bash
This is Edition 5.0, last updated 9 November 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.0, 7 August 2018). The Bash home page is
Bash shell (version 5.0, 9 November 2018). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.0, last updated 7 August 2018, of 'The GNU Bash
This is Edition 5.0, last updated 9 November 2018, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.0.
Bash contains features that appear in other popular shells, and some
@@ -1468,10 +1468,11 @@ only be referenced; assignment to them is not allowed.
($_, an underscore.) At shell startup, set to the absolute
pathname used to invoke the shell or shell script being executed as
passed in the environment or argument list. Subsequently, expands
to the last argument to the previous command, after expansion.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command. When
checking mail, this parameter holds the name of the mail file.
to the last argument to the previous simple command executed in the
foreground, after expansion. Also set to the full pathname used to
invoke each command executed and placed in the environment exported
to that command. When checking mail, this parameter holds the name
of the mail file.

File: bashref.info, Node: Shell Expansions, Next: Redirections, Prev: Shell Parameters, Up: Basic Shell Features
@@ -3201,17 +3202,21 @@ standard.
the expression is false.
3 arguments
The following conditions are applied in the order listed. If
the second argument is one of the binary conditional operators
(*note Bash Conditional Expressions::), the result of the
expression is the result of the binary test using the first
and third arguments as operands. The '-a' and '-o' operators
are considered binary operators when there are three
arguments. If the first argument is '!', the value is the
negation of the two-argument test using the second and third
arguments. If the first argument is exactly '(' and the third
argument is exactly ')', the result is the one-argument test
of the second argument. Otherwise, the expression is false.
The following conditions are applied in the order listed.
1. If the second argument is one of the binary conditional
operators (*note Bash Conditional Expressions::), the
result of the expression is the result of the binary test
using the first and third arguments as operands. The
'-a' and '-o' operators are considered binary operators
when there are three arguments.
2. If the first argument is '!', the value is the negation
of the two-argument test using the second and third
arguments.
3. If the first argument is exactly '(' and the third
argument is exactly ')', the result is the one-argument
test of the second argument.
4. Otherwise, the expression is false.
4 arguments
If the first argument is '!', the result is the negation of
@@ -3842,8 +3847,8 @@ standard.
'-r'
If this option is given, backslash does not act as an escape
character. The backslash is considered to be part of the
line. In particular, a backslash-newline pair may not be used
as a line continuation.
line. In particular, a backslash-newline pair may not then be
used as a line continuation.
'-s'
Silent mode. If input is coming from a terminal, characters
@@ -4406,7 +4411,7 @@ This builtin allows you to change additional shell optional behavior.
'checkwinsize'
If set, Bash checks the window size after each external
(non-builtin) command and, if necessary, updates the values of
'LINES' and 'COLUMNS'.
'LINES' and 'COLUMNS'. This option is enabled by default.
'cmdhist'
If set, Bash attempts to save all lines of a multiple-line
@@ -4631,6 +4636,13 @@ This builtin allows you to change additional shell optional behavior.
before any new value is assigned. The NAMEREF attribute is
not inherited.
'localvar_unset'
If set, calling 'unset' on local variables in previous
function scopes marks them so subsequent lookups find them
unset until that function returns. This is identical to the
behavior of unsetting local variables at the current function
scope.
'login_shell'
The shell sets this option if it is started as a login shell
(*note Invoking Bash::). The value may not be changed.
@@ -4665,6 +4677,13 @@ This builtin allows you to change additional shell optional behavior.
Programmable Completion::) are enabled. This option is
enabled by default.
'progcomp_alias'
If set, and programmable completion is enabled, Bash treats a
command name that doesn't have any completions as a possible
alias and attempts alias expansion. If it has an alias, Bash
attempts programmable completion using the command word
resulting from the expanded alias.
'promptvars'
If set, prompt strings undergo parameter expansion, command
substitution, arithmetic expansion, and quote removal after
@@ -5912,18 +5931,21 @@ File: bashref.info, Node: Bash Conditional Expressions, Next: Shell Arithmetic
================================
Conditional expressions are used by the '[[' compound command and the
'test' and '[' builtin commands.
'test' and '[' builtin commands. The 'test' and '[' commands determine
their behavior based on the number of arguments; see the descriptions of
those commands for any other command-specific actions.
Expressions may be unary or binary. Unary expressions are often used
to examine the status of a file. There are string operators and numeric
comparison operators as well. Bash handles several filenames specially
when they are used in expressions. If the operating system on which
Bash is running provides these special files, Bash will use them;
otherwise it will emulate them internally with this behavior: If the
FILE argument to one of the primaries is of the form '/dev/fd/N', then
file descriptor N is checked. If the FILE argument to one of the
primaries is one of '/dev/stdin', '/dev/stdout', or '/dev/stderr', file
descriptor 0, 1, or 2, respectively, is checked.
Expressions may be unary or binary, and are formed from the following
primaries. Unary expressions are often used to examine the status of a
file. There are string operators and numeric comparison operators as
well. Bash handles several filenames specially when they are used in
expressions. If the operating system on which Bash is running provides
these special files, Bash will use them; otherwise it will emulate them
internally with this behavior: If the FILE argument to one of the
primaries is of the form '/dev/fd/N', then file descriptor N is checked.
If the FILE argument to one of the primaries is one of '/dev/stdin',
'/dev/stdout', or '/dev/stderr', file descriptor 0, 1, or 2,
respectively, is checked.
When used with '[[', the '<' and '>' operators sort lexicographically
using the current locale. The 'test' command uses ASCII ordering.
@@ -6183,9 +6205,10 @@ the 'expand_aliases' shell option is set using 'shopt' (*note The Shopt
Builtin::).
The rules concerning the definition and use of aliases are somewhat
confusing. Bash always reads at least one complete line of input before
executing any of the commands on that line. Aliases are expanded when a
command is read, not when it is executed. Therefore, an alias
confusing. Bash always reads at least one complete line of input, and
all lines that make up a compound command, before executing any of the
commands on that line or the compound command. Aliases are expanded
when a command is read, not when it is executed. Therefore, an alias
definition appearing on the same line as another command does not take
effect until the next line of input is read. The commands following the
alias definition on that line are not affected by the new alias. This
@@ -6703,56 +6726,66 @@ startup files.
shell. When the 'inherit_errexit' option is not enabled, Bash
clears the '-e' option in such subshells.
44. When the 'alias' builtin displays alias definitions, it does not
44. 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
display them with a leading 'alias ' unless the '-p' option is
supplied.
45. When the 'set' builtin is invoked without options, it does not
46. When the 'set' builtin is invoked without options, it does not
display shell function names and definitions.
46. When the 'set' builtin is invoked without options, it displays
47. 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.
47. When the 'cd' builtin is invoked in LOGICAL mode, and the pathname
48. 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.
48. The 'pwd' builtin verifies that the value it prints is the same as
49. 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
the current directory, even if it is not asked to check the file
system with the '-P' option.
49. When listing the history, the 'fc' builtin does not include an
51. When listing the history, the 'fc' builtin does not include an
indication of whether or not a history entry has been modified.
50. The default editor used by 'fc' is 'ed'.
52. The default editor used by 'fc' is 'ed'.
51. The 'type' and 'command' builtins will not report a non-executable
53. 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'.
52. The 'vi' editing mode will invoke the 'vi' editor directly when
54. The 'vi' editing mode will invoke the 'vi' editor directly when
the 'v' command is run, instead of checking '$VISUAL' and
'$EDITOR'.
53. When the 'xpg_echo' option is enabled, Bash does not attempt to
55. 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.
54. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
56. The 'ulimit' builtin uses a block size of 512 bytes for the '-c'
and '-f' options.
55. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not
57. 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.
56. The 'read' builtin may be interrupted by a signal for which a trap
58. 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.
57. Bash removes an exited background process's status from the list
59. 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
@@ -7525,13 +7558,13 @@ Variable Settings
'keymap'
Sets Readline's idea of the current keymap for key binding
commands. Acceptable 'keymap' names are 'emacs',
commands. Built-in 'keymap' names are 'emacs',
'emacs-standard', 'emacs-meta', 'emacs-ctlx', 'vi', 'vi-move',
'vi-command', and 'vi-insert'. 'vi' is equivalent to
'vi-command' ('vi-move' is also a synonym); 'emacs' is
equivalent to 'emacs-standard'. The default value is 'emacs'.
The value of the 'editing-mode' variable also affects the
default keymap.
equivalent to 'emacs-standard'. Applications may add
additional names. The default value is 'emacs'. The value of
the 'editing-mode' variable also affects the default keymap.
'keyseq-timeout'
Specifies the duration Readline will wait for a character when
@@ -8626,7 +8659,10 @@ command word is a full pathname, a compspec for the full pathname is
searched for first. If no compspec is found for the full pathname, an
attempt is made to find a compspec for the portion following the final
slash. If those searches do not result in a compspec, any compspec
defined with the '-D' option to 'complete' is used as the default.
defined with the '-D' option to 'complete' is used as the default. If
there is no default compspec, Bash attempts alias expansion on the
command word as a final resort, and attempts to find a compspec for the
command word from any successful expansion
Once a compspec has been found, it is used to generate the list of
matching words. If a compspec is not found, the default Bash completion
@@ -11000,17 +11036,17 @@ D.1 Index of Shell Builtin Commands
* test: Bourne Shell Builtins.
(line 269)
* times: Bourne Shell Builtins.
(line 344)
(line 348)
* trap: Bourne Shell Builtins.
(line 350)
(line 354)
* type: Bash Builtins. (line 567)
* typeset: Bash Builtins. (line 599)
* ulimit: Bash Builtins. (line 605)
* umask: Bourne Shell Builtins.
(line 399)
(line 403)
* unalias: Bash Builtins. (line 704)
* unset: Bourne Shell Builtins.
(line 417)
(line 421)
* wait: Job Control Builtins.
(line 76)
@@ -11644,134 +11680,134 @@ D.5 Concept Index

Tag Table:
Node: Top891
Node: Introduction2805
Node: What is Bash?3021
Node: What is a shell?4135
Node: Definitions6673
Node: Basic Shell Features9624
Node: Shell Syntax10843
Node: Shell Operation11869
Node: Quoting13162
Node: Escape Character14462
Node: Single Quotes14947
Node: Double Quotes15295
Node: ANSI-C Quoting16573
Node: Locale Translation17832
Node: Comments18728
Node: Shell Commands19346
Node: Simple Commands20218
Node: Pipelines20849
Node: Lists23781
Node: Compound Commands25520
Node: Looping Constructs26532
Node: Conditional Constructs29027
Node: Command Grouping40110
Node: Coprocesses41589
Node: GNU Parallel43492
Node: Shell Functions47550
Node: Shell Parameters54633
Node: Positional Parameters59046
Node: Special Parameters59946
Node: Shell Expansions63660
Node: Brace Expansion65783
Node: Tilde Expansion68507
Node: Shell Parameter Expansion71124
Node: Command Substitution85580
Node: Arithmetic Expansion86935
Node: Process Substitution87867
Node: Word Splitting88987
Node: Filename Expansion90931
Node: Pattern Matching93461
Node: Quote Removal97447
Node: Redirections97742
Node: Executing Commands107300
Node: Simple Command Expansion107970
Node: Command Search and Execution109900
Node: Command Execution Environment112276
Node: Environment115260
Node: Exit Status116919
Node: Signals118589
Node: Shell Scripts120556
Node: Shell Builtin Commands123071
Node: Bourne Shell Builtins125109
Node: Bash Builtins145767
Node: Modifying Shell Behavior174675
Node: The Set Builtin175020
Node: The Shopt Builtin185433
Node: Special Builtins202303
Node: Shell Variables203282
Node: Bourne Shell Variables203719
Node: Bash Variables205823
Node: Bash Features236283
Node: Invoking Bash237182
Node: Bash Startup Files243195
Node: Interactive Shells248298
Node: What is an Interactive Shell?248708
Node: Is this Shell Interactive?249357
Node: Interactive Shell Behavior250172
Node: Bash Conditional Expressions253659
Node: Shell Arithmetic258025
Node: Aliases260842
Node: Arrays263390
Node: The Directory Stack268756
Node: Directory Stack Builtins269540
Node: Controlling the Prompt272508
Node: The Restricted Shell275274
Node: Bash POSIX Mode277099
Node: Job Control287514
Node: Job Control Basics287974
Node: Job Control Builtins292942
Node: Job Control Variables297669
Node: Command Line Editing298825
Node: Introduction and Notation300496
Node: Readline Interaction302119
Node: Readline Bare Essentials303310
Node: Readline Movement Commands305093
Node: Readline Killing Commands306053
Node: Readline Arguments307971
Node: Searching309015
Node: Readline Init File311201
Node: Readline Init File Syntax312348
Node: Conditional Init Constructs332748
Node: Sample Init File336944
Node: Bindable Readline Commands340061
Node: Commands For Moving341265
Node: Commands For History343114
Node: Commands For Text347409
Node: Commands For Killing350797
Node: Numeric Arguments353278
Node: Commands For Completion354417
Node: Keyboard Macros358608
Node: Miscellaneous Commands359295
Node: Readline vi Mode365248
Node: Programmable Completion366155
Node: Programmable Completion Builtins373749
Node: A Programmable Completion Example384442
Node: Using History Interactively389682
Node: Bash History Facilities390366
Node: Bash History Builtins393371
Node: History Interaction397902
Node: Event Designators401522
Node: Word Designators402741
Node: Modifiers404378
Node: Installing Bash405780
Node: Basic Installation406917
Node: Compilers and Options410175
Node: Compiling For Multiple Architectures410916
Node: Installation Names412609
Node: Specifying the System Type413427
Node: Sharing Defaults414143
Node: Operation Controls414816
Node: Optional Features415774
Node: Reporting Bugs426292
Node: Major Differences From The Bourne Shell427486
Node: GNU Free Documentation License444338
Node: Indexes469515
Node: Builtin Index469969
Node: Reserved Word Index476796
Node: Variable Index479244
Node: Function Index494995
Node: Concept Index508298
Node: Top895
Node: Introduction2813
Node: What is Bash?3029
Node: What is a shell?4143
Node: Definitions6681
Node: Basic Shell Features9632
Node: Shell Syntax10851
Node: Shell Operation11877
Node: Quoting13170
Node: Escape Character14470
Node: Single Quotes14955
Node: Double Quotes15303
Node: ANSI-C Quoting16581
Node: Locale Translation17840
Node: Comments18736
Node: Shell Commands19354
Node: Simple Commands20226
Node: Pipelines20857
Node: Lists23789
Node: Compound Commands25528
Node: Looping Constructs26540
Node: Conditional Constructs29035
Node: Command Grouping40118
Node: Coprocesses41597
Node: GNU Parallel43500
Node: Shell Functions47558
Node: Shell Parameters54641
Node: Positional Parameters59054
Node: Special Parameters59954
Node: Shell Expansions63708
Node: Brace Expansion65831
Node: Tilde Expansion68555
Node: Shell Parameter Expansion71172
Node: Command Substitution85628
Node: Arithmetic Expansion86983
Node: Process Substitution87915
Node: Word Splitting89035
Node: Filename Expansion90979
Node: Pattern Matching93509
Node: Quote Removal97495
Node: Redirections97790
Node: Executing Commands107348
Node: Simple Command Expansion108018
Node: Command Search and Execution109948
Node: Command Execution Environment112324
Node: Environment115308
Node: Exit Status116967
Node: Signals118637
Node: Shell Scripts120604
Node: Shell Builtin Commands123119
Node: Bourne Shell Builtins125157
Node: Bash Builtins145907
Node: Modifying Shell Behavior174820
Node: The Set Builtin175165
Node: The Shopt Builtin185578
Node: Special Builtins203150
Node: Shell Variables204129
Node: Bourne Shell Variables204566
Node: Bash Variables206670
Node: Bash Features237130
Node: Invoking Bash238029
Node: Bash Startup Files244042
Node: Interactive Shells249145
Node: What is an Interactive Shell?249555
Node: Is this Shell Interactive?250204
Node: Interactive Shell Behavior251019
Node: Bash Conditional Expressions254506
Node: Shell Arithmetic259083
Node: Aliases261900
Node: Arrays264520
Node: The Directory Stack269886
Node: Directory Stack Builtins270670
Node: Controlling the Prompt273638
Node: The Restricted Shell276404
Node: Bash POSIX Mode278229
Node: Job Control289162
Node: Job Control Basics289622
Node: Job Control Builtins294590
Node: Job Control Variables299317
Node: Command Line Editing300473
Node: Introduction and Notation302144
Node: Readline Interaction303767
Node: Readline Bare Essentials304958
Node: Readline Movement Commands306741
Node: Readline Killing Commands307701
Node: Readline Arguments309619
Node: Searching310663
Node: Readline Init File312849
Node: Readline Init File Syntax313996
Node: Conditional Init Constructs334435
Node: Sample Init File338631
Node: Bindable Readline Commands341748
Node: Commands For Moving342952
Node: Commands For History344801
Node: Commands For Text349096
Node: Commands For Killing352484
Node: Numeric Arguments354965
Node: Commands For Completion356104
Node: Keyboard Macros360295
Node: Miscellaneous Commands360982
Node: Readline vi Mode366935
Node: Programmable Completion367842
Node: Programmable Completion Builtins375622
Node: A Programmable Completion Example386315
Node: Using History Interactively391555
Node: Bash History Facilities392239
Node: Bash History Builtins395244
Node: History Interaction399775
Node: Event Designators403395
Node: Word Designators404614
Node: Modifiers406251
Node: Installing Bash407653
Node: Basic Installation408790
Node: Compilers and Options412048
Node: Compiling For Multiple Architectures412789
Node: Installation Names414482
Node: Specifying the System Type415300
Node: Sharing Defaults416016
Node: Operation Controls416689
Node: Optional Features417647
Node: Reporting Bugs428165
Node: Major Differences From The Bourne Shell429359
Node: GNU Free Documentation License446211
Node: Indexes471388
Node: Builtin Index471842
Node: Reserved Word Index478669
Node: Variable Index481117
Node: Function Index496868
Node: Concept Index510171

End Tag Table
BIN
View File
Binary file not shown.
+2692 -2647
View File
File diff suppressed because it is too large Load Diff
+47 -9
View File
@@ -1738,8 +1738,8 @@ to the filename used to invoke Bash, as given by argument zero.
At shell startup, set to the absolute pathname used to invoke the
shell or shell script being executed as passed in the environment
or argument list.
Subsequently, expands to the last argument to the previous command,
after expansion.
Subsequently, expands to the last argument to the previous simple
command executed in the foreground, after expansion.
Also set to the full pathname used to invoke each command executed
and placed in the environment exported to that command.
When checking mail, this parameter holds the name of the mail file.
@@ -3795,18 +3795,25 @@ false.
@item 3 arguments
The following conditions are applied in the order listed.
@enumerate
@item
If the second argument is one of the binary conditional
operators (@pxref{Bash Conditional Expressions}), the
result of the expression is the result of the binary test using the
first and third arguments as operands.
The @samp{-a} and @samp{-o} operators are considered binary operators
when there are three arguments.
@item
If the first argument is @samp{!}, the value is the negation of
the two-argument test using the second and third arguments.
@item
If the first argument is exactly @samp{(} and the third argument is
exactly @samp{)}, the result is the one-argument test of the second
argument.
@item
Otherwise, the expression is false.
@end enumerate
@item 4 arguments
If the first argument is @samp{!}, the result is the negation of
@@ -4557,7 +4564,7 @@ The prompt is displayed only if input is coming from a terminal.
@item -r
If this option is given, backslash does not act as an escape character.
The backslash is considered to be part of the line.
In particular, a backslash-newline pair may not be used as a line
In particular, a backslash-newline pair may not then be used as a line
continuation.
@item -s
@@ -5171,6 +5178,7 @@ The shell always postpones exiting if any jobs are stopped.
If set, Bash checks the window size after each external (non-builtin)
command and, if necessary, updates the values of
@env{LINES} and @env{COLUMNS}.
This option is enabled by default.
@item cmdhist
If set, Bash
@@ -5409,6 +5417,12 @@ If set, local variables inherit the value and attributes of a variable of
the same name that exists at a previous scope before any new value is
assigned. The @var{nameref} attribute is not inherited.
@item localvar_unset
If set, calling @code{unset} on local variables in previous function scopes
marks them so subsequent lookups find them unset until that function
returns. This is identical to the behavior of unsetting local variables
at the current function scope.
@item login_shell
The shell sets this option if it is started as a login shell
(@pxref{Invoking Bash}).
@@ -5444,6 +5458,12 @@ If set, the programmable completion facilities
(@pxref{Programmable Completion}) are enabled.
This option is enabled by default.
@item progcomp_alias
If set, and programmable completion is enabled, Bash treats a command
name that doesn't have any completions as a possible alias and attempts
alias expansion. If it has an alias, Bash attempts programmable
completion using the command word resulting from the expanded alias.
@item promptvars
If set, prompt strings undergo
parameter expansion, command substitution, arithmetic
@@ -6808,9 +6828,13 @@ printing @env{$PS1} (@pxref{Bash Variables}).
@cindex expressions, conditional
Conditional expressions are used by the @code{[[} compound command
and the @code{test} and @code{[} builtin commands.
and the @code{test} and @code{[} builtin commands. The @code{test}
and @code{[} commands determine their behavior based on the number
of arguments; see the descriptions of those commands for any other
command-specific actions.
Expressions may be unary or binary.
Expressions may be unary or binary,
and are formed from the following primaries.
Unary expressions are often used to examine the status of a file.
There are string operators and numeric comparison operators as well.
Bash handles several filenames specially when they are used in
@@ -7101,10 +7125,11 @@ unless the @code{expand_aliases} shell option is set using
@code{shopt} (@pxref{The Shopt Builtin}).
The rules concerning the definition and use of aliases are
somewhat confusing. Bash
always reads at least one complete line
of input before executing any
of the commands on that line. Aliases are expanded when a
somewhat confusing. Bash
always reads at least one complete line of input,
and all lines that make up a compound command,
before executing any of the commands on that line or the compound command.
Aliases are expanded when a
command is read, not when it is executed. Therefore, an
alias definition appearing on the same line as another
command does not take effect until the next line of input is read.
@@ -7732,6 +7757,12 @@ the @option{-e} option from the parent shell.
When the @code{inherit_errexit} option is not enabled,
Bash clears the @option{-e} option in such subshells.
@item
Enabling @sc{posix} mode has the effect of setting the
@code{shift_verbose} option, so numeric arguments to @code{shift}
that exceed the number of positional parameters will result in an
error message.
@item
When the @code{alias} builtin displays alias definitions, it does not
display them with a leading @samp{alias } unless the @option{-p} option
@@ -7752,6 +7783,13 @@ constructed from @code{$PWD} and the directory name supplied as an argument
does not refer to an existing directory, @code{cd} will fail instead of
falling back to @var{physical} mode.
@item
When the @code{cd} builtin cannot change a directory because the
length of the pathname
constructed from @code{$PWD} and the directory name supplied as an argument
exceeds @var{PATH_MAX} when all symbolic links are expanded, @code{cd} will
fail instead of attempting to use only the supplied directory name.
@item
The @code{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
+127 -113
View File
@@ -1017,8 +1017,8 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
displayed only if input is coming from a terminal.
--rr Backslash does not act as an escape character. The back-
slash is considered to be part of the line. In particu-
lar, a backslash-newline pair may not be used as a line
continuation.
lar, a backslash-newline pair may not then be used as a
line continuation.
--ss Silent mode. If input is coming from a terminal, charac-
ters are not echoed.
--tt _t_i_m_e_o_u_t
@@ -1340,230 +1340,244 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
cchheecckkwwiinnssiizzee
If set, bbaasshh checks the window size after each external
(non-builtin) command and, if necessary, updates the
values of LLIINNEESS and CCOOLLUUMMNNSS.
ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple-
line command in the same history entry. This allows
easy re-editing of multi-line commands. This option is
enabled by default, but only has an effect if command
values of LLIINNEESS and CCOOLLUUMMNNSS. This option is enabled by
default.
ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple-
line command in the same history entry. This allows
easy re-editing of multi-line commands. This option is
enabled by default, but only has an effect if command
history is enabled, as described above under HHIISSTTOORRYY.
ccoommppaatt3311
If set, bbaasshh changes its behavior to that of version 3.1
with respect to quoted arguments to the [[[[ conditional
with respect to quoted arguments to the [[[[ conditional
command's ==~~ operator and locale-specific string compar-
ison when using the [[[[ conditional command's << and >>
operators. Bash versions prior to bash-4.1 use ASCII
ison when using the [[[[ conditional command's << and >>
operators. Bash versions prior to bash-4.1 use ASCII
collation and _s_t_r_c_m_p(3); bash-4.1 and later use the cur-
rent locale's collation sequence and _s_t_r_c_o_l_l(3).
ccoommppaatt3322
If set, bbaasshh changes its behavior to that of version 3.2
with respect to locale-specific string comparison when
using the [[[[ conditional command's << and >> operators
(see previous item) and the effect of interrupting a
command list. Bash versions 3.2 and earlier continue
with the next command in the list after one terminates
with respect to locale-specific string comparison when
using the [[[[ conditional command's << and >> operators
(see previous item) and the effect of interrupting a
command list. Bash versions 3.2 and earlier continue
with the next command in the list after one terminates
due to an interrupt.
ccoommppaatt4400
If set, bbaasshh changes its behavior to that of version 4.0
with respect to locale-specific string comparison when
using the [[[[ conditional command's << and >> operators
(see description of ccoommppaatt3311) and the effect of inter-
rupting a command list. Bash versions 4.0 and later
interrupt the list as if the shell received the inter-
rupt; previous versions continue with the next command
with respect to locale-specific string comparison when
using the [[[[ conditional command's << and >> operators
(see description of ccoommppaatt3311) and the effect of inter-
rupting a command list. Bash versions 4.0 and later
interrupt the list as if the shell received the inter-
rupt; previous versions continue with the next command
in the list.
ccoommppaatt4411
If set, bbaasshh, when in _p_o_s_i_x _m_o_d_e, treats a single quote
in a double-quoted parameter expansion as a special
character. The single quotes must match (an even num-
ber) and the characters between the single quotes are
considered quoted. This is the behavior of posix mode
through version 4.1. The default bash behavior remains
If set, bbaasshh, when in _p_o_s_i_x _m_o_d_e, treats a single quote
in a double-quoted parameter expansion as a special
character. The single quotes must match (an even num-
ber) and the characters between the single quotes are
considered quoted. This is the behavior of posix mode
through version 4.1. The default bash behavior remains
as in previous versions.
ccoommppaatt4422
If set, bbaasshh does not process the replacement string in
the pattern substitution word expansion using quote
If set, bbaasshh does not process the replacement string in
the pattern substitution word expansion using quote
removal.
ccoommppaatt4433
If set, bbaasshh does not print a warning message if an
attempt is made to use a quoted compound array assign-
ment as an argument to ddeeccllaarree, makes word expansion
errors non-fatal errors that cause the current command
to fail (the default behavior is to make them fatal
If set, bbaasshh does not print a warning message if an
attempt is made to use a quoted compound array assign-
ment as an argument to ddeeccllaarree, makes word expansion
errors non-fatal errors that cause the current command
to fail (the default behavior is to make them fatal
errors that cause the shell to exit), and does not reset
the loop state when a shell function is executed (this
allows bbrreeaakk or ccoonnttiinnuuee in a shell function to affect
the loop state when a shell function is executed (this
allows bbrreeaakk or ccoonnttiinnuuee in a shell function to affect
loops in the caller's context).
ccoommppaatt4444
If set, bbaasshh saves the positional parameters to
If set, bbaasshh saves the positional parameters to
BASH_ARGV and BASH_ARGC before they are used, regardless
of whether or not extended debugging mode is enabled.
ccoommpplleettee__ffuullllqquuoottee
If set, bbaasshh quotes all shell metacharacters in file-
names and directory names when performing completion.
If set, bbaasshh quotes all shell metacharacters in file-
names and directory names when performing completion.
If not set, bbaasshh removes metacharacters such as the dol-
lar sign from the set of characters that will be quoted
in completed filenames when these metacharacters appear
in shell variable references in words to be completed.
This means that dollar signs in variable names that
expand to directories will not be quoted; however, any
dollar signs appearing in filenames will not be quoted,
either. This is active only when bash is using back-
slashes to quote completed filenames. This variable is
set by default, which is the default bash behavior in
lar sign from the set of characters that will be quoted
in completed filenames when these metacharacters appear
in shell variable references in words to be completed.
This means that dollar signs in variable names that
expand to directories will not be quoted; however, any
dollar signs appearing in filenames will not be quoted,
either. This is active only when bash is using back-
slashes to quote completed filenames. This variable is
set by default, which is the default bash behavior in
versions through 4.2.
ddiirreexxppaanndd
If set, bbaasshh replaces directory names with the results
of word expansion when performing filename completion.
This changes the contents of the readline editing buf-
fer. If not set, bbaasshh attempts to preserve what the
If set, bbaasshh replaces directory names with the results
of word expansion when performing filename completion.
This changes the contents of the readline editing buf-
fer. If not set, bbaasshh attempts to preserve what the
user typed.
ddiirrssppeellll
If set, bbaasshh attempts spelling correction on directory
names during word completion if the directory name ini-
If set, bbaasshh attempts spelling correction on directory
names during word completion if the directory name ini-
tially supplied does not exist.
ddoottgglloobb If set, bbaasshh includes filenames beginning with a `.' in
the results of pathname expansion. The filenames ````..''''
and ````....'''' must always be matched explicitly, even if
ddoottgglloobb If set, bbaasshh includes filenames beginning with a `.' in
the results of pathname expansion. The filenames ````..''''
and ````....'''' must always be matched explicitly, even if
ddoottgglloobb is set.
eexxeeccffaaiill
If set, a non-interactive shell will not exit if it can-
not execute the file specified as an argument to the
eexxeecc builtin command. An interactive shell does not
not execute the file specified as an argument to the
eexxeecc builtin command. An interactive shell does not
exit if eexxeecc fails.
eexxppaanndd__aalliiaasseess
If set, aliases are expanded as described above under
If set, aliases are expanded as described above under
AALLIIAASSEESS. This option is enabled by default for interac-
tive shells.
eexxttddeebbuugg
If set at shell invocation, arrange to execute the
debugger profile before the shell starts, identical to
the ----ddeebbuuggggeerr option. If set after invocation, behav-
If set at shell invocation, arrange to execute the
debugger profile before the shell starts, identical to
the ----ddeebbuuggggeerr option. If set after invocation, behav-
ior intended for use by debuggers is enabled:
11.. The --FF option to the ddeeccllaarree builtin displays the
source file name and line number corresponding to
each function name supplied as an argument.
22.. If the command run by the DDEEBBUUGG trap returns a
non-zero value, the next command is skipped and
22.. If the command run by the DDEEBBUUGG trap returns a
non-zero value, the next command is skipped and
not executed.
33.. If the command run by the DDEEBBUUGG trap returns a
value of 2, and the shell is executing in a sub-
routine (a shell function or a shell script exe-
cuted by the .. or ssoouurrccee builtins), the shell
33.. If the command run by the DDEEBBUUGG trap returns a
value of 2, and the shell is executing in a sub-
routine (a shell function or a shell script exe-
cuted by the .. or ssoouurrccee builtins), the shell
simulates a call to rreettuurrnn.
44.. BBAASSHH__AARRGGCC and BBAASSHH__AARRGGVV are updated as described
44.. BBAASSHH__AARRGGCC and BBAASSHH__AARRGGVV are updated as described
in their descriptions above.
55.. Function tracing is enabled: command substitu-
55.. Function tracing is enabled: command substitu-
tion, shell functions, and subshells invoked with
(( _c_o_m_m_a_n_d )) inherit the DDEEBBUUGG and RREETTUURRNN traps.
66.. Error tracing is enabled: command substitution,
shell functions, and subshells invoked with ((
66.. Error tracing is enabled: command substitution,
shell functions, and subshells invoked with ((
_c_o_m_m_a_n_d )) inherit the EERRRR trap.
eexxttgglloobb If set, the extended pattern matching features described
above under PPaatthhnnaammee EExxppaannssiioonn are enabled.
eexxttqquuoottee
If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed
within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double
If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed
within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double
quotes. This option is enabled by default.
ffaaiillgglloobb
If set, patterns which fail to match filenames during
If set, patterns which fail to match filenames during
pathname expansion result in an expansion error.
ffoorrccee__ffiiggnnoorree
If set, the suffixes specified by the FFIIGGNNOORREE shell
variable cause words to be ignored when performing word
If set, the suffixes specified by the FFIIGGNNOORREE shell
variable cause words to be ignored when performing word
completion even if the ignored words are the only possi-
ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS above for a
description of FFIIGGNNOORREE. This option is enabled by
description of FFIIGGNNOORREE. This option is enabled by
default.
gglloobbaasscciiiirraannggeess
If set, range expressions used in pattern matching
bracket expressions (see PPaatttteerrnn MMaattcchhiinngg above) behave
as if in the traditional C locale when performing com-
If set, range expressions used in pattern matching
bracket expressions (see PPaatttteerrnn MMaattcchhiinngg above) behave
as if in the traditional C locale when performing com-
parisons. That is, the current locale's collating
sequence is not taken into account, so bb will not col-
late between AA and BB, and upper-case and lower-case
sequence is not taken into account, so bb will not col-
late between AA and BB, and upper-case and lower-case
ASCII characters will collate together.
gglloobbssttaarr
If set, the pattern **** used in a pathname expansion con-
text will match all files and zero or more directories
and subdirectories. If the pattern is followed by a //,
text will match all files and zero or more directories
and subdirectories. If the pattern is followed by a //,
only directories and subdirectories match.
ggnnuu__eerrrrffmmtt
If set, shell error messages are written in the standard
GNU error message format.
hhiissttaappppeenndd
If set, the history list is appended to the file named
by the value of the HHIISSTTFFIILLEE variable when the shell
If set, the history list is appended to the file named
by the value of the HHIISSTTFFIILLEE variable when the shell
exits, rather than overwriting the file.
hhiissttrreeeeddiitt
If set, and rreeaaddlliinnee is being used, a user is given the
If set, and rreeaaddlliinnee is being used, a user is given the
opportunity to re-edit a failed history substitution.
hhiissttvveerriiffyy
If set, and rreeaaddlliinnee is being used, the results of his-
tory substitution are not immediately passed to the
shell parser. Instead, the resulting line is loaded
If set, and rreeaaddlliinnee is being used, the results of his-
tory substitution are not immediately passed to the
shell parser. Instead, the resulting line is loaded
into the rreeaaddlliinnee editing buffer, allowing further modi-
fication.
hhoossttccoommpplleettee
If set, and rreeaaddlliinnee is being used, bbaasshh will attempt to
perform hostname completion when a word containing a @@
is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE
perform hostname completion when a word containing a @@
is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE
above). This is enabled by default.
hhuuppoonneexxiitt
If set, bbaasshh will send SSIIGGHHUUPP to all jobs when an inter-
active login shell exits.
iinnhheerriitt__eerrrreexxiitt
If set, command substitution inherits the value of the
eerrrreexxiitt option, instead of unsetting it in the subshell
environment. This option is enabled when _p_o_s_i_x _m_o_d_e is
If set, command substitution inherits the value of the
eerrrreexxiitt option, instead of unsetting it in the subshell
environment. This option is enabled when _p_o_s_i_x _m_o_d_e is
enabled.
iinntteerraaccttiivvee__ccoommmmeennttss
If set, allow a word beginning with ## to cause that word
and all remaining characters on that line to be ignored
in an interactive shell (see CCOOMMMMEENNTTSS above). This
and all remaining characters on that line to be ignored
in an interactive shell (see CCOOMMMMEENNTTSS above). This
option is enabled by default.
llaassttppiippee
If set, and job control is not active, the shell runs
If set, and job control is not active, the shell runs
the last command of a pipeline not executed in the back-
ground in the current shell environment.
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
llooccaallvvaarr__iinnhheerriitt
If set, local variables inherit the value and attributes
of a variable of the same name that exists at a previous
scope before any new value is assigned. The nameref
scope before any new value is assigned. The nameref
attribute is not inherited.
llooccaallvvaarr__uunnsseett
If set, calling uunnsseett on local variables in previous
function scopes marks them so subsequent lookups find
them unset until that function returns. This is identi-
cal to the behavior of unsetting local variables at the
current function scope.
llooggiinn__sshheellll
The shell sets this option if it is started as a login
shell (see IINNVVOOCCAATTIIOONN above). The value may not be
The shell sets this option if it is started as a login
shell (see IINNVVOOCCAATTIIOONN above). The value may not be
changed.
mmaaiillwwaarrnn
If set, and a file that bbaasshh is checking for mail has
been accessed since the last time it was checked, the
message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis-
If set, and a file that bbaasshh is checking for mail has
been accessed since the last time it was checked, the
message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis-
played.
nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn
If set, and rreeaaddlliinnee is being used, bbaasshh will not
If set, and rreeaaddlliinnee is being used, bbaasshh will not
attempt to search the PPAATTHH for possible completions when
completion is attempted on an empty line.
nnooccaasseegglloobb
If set, bbaasshh matches filenames in a case-insensitive
If set, bbaasshh matches filenames in a case-insensitive
fashion when performing pathname expansion (see PPaatthhnnaammee
EExxppaannssiioonn above).
nnooccaasseemmaattcchh
If set, bbaasshh matches patterns in a case-insensitive
If set, bbaasshh matches patterns in a case-insensitive
fashion when performing matching while executing ccaassee or
[[[[ conditional commands, when performing pattern substi-
tution word expansions, or when filtering possible com-
tution word expansions, or when filtering possible com-
pletions as part of programmable completion.
nnuullllgglloobb
If set, bbaasshh allows patterns which match no files (see
PPaatthhnnaammee EExxppaannssiioonn above) to expand to a null string,
If set, bbaasshh allows patterns which match no files (see
PPaatthhnnaammee EExxppaannssiioonn above) to expand to a null string,
rather than themselves.
pprrooggccoommpp
If set, the programmable completion facilities (see PPrroo--
ggrraammmmaabbllee CCoommpplleettiioonn above) are enabled. This option is
enabled by default.
pprrooggccoommpp__aalliiaass
If set, and programmable completion is enabled, bbaasshh
treats a command name that doesn't have any completions
as a possible alias and attempts alias expansion. If it
has an alias, bbaasshh attempts programmable completion
using the command word resulting from the expanded
alias.
pprroommppttvvaarrss
If set, prompt strings undergo parameter expansion, com-
mand substitution, arithmetic expansion, and quote
+667 -647
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
%%Creator: groff version 1.22.3
%%CreationDate: Fri Sep 7 15:34:15 2018
%%CreationDate: Mon Nov 19 15:20:58 2018
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%DocumentSuppliedResources: procset grops 1.22 3
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2018 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Tue Aug 7 12:01:22 EDT 2018
@set LASTCHANGE Fri Nov 9 14:24:49 EST 2018
@set EDITION 5.0
@set VERSION 5.0
@set UPDATED 7 August 2018
@set UPDATED-MONTH August 2018
@set UPDATED 9 November 2018
@set UPDATED-MONTH November 2018
+8 -3
View File
@@ -100,10 +100,10 @@ INC = -I. -I.. -I$(topdir) -I$(topdir)/lib -I$(topdir)/builtins -I${srcdir} \
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $<
ALLPROG = print truefalse sleep finfo logname basename dirname \
ALLPROG = print truefalse sleep finfo logname basename dirname fdflags \
tty pathchk tee head mkdir rmdir printenv id whoami \
uname sync push ln unlink realpath strftime mypid setpgid
OTHERPROG = necho hello cat pushd stat rm fdflags
uname sync push ln unlink realpath strftime mypid setpgid seq
OTHERPROG = necho hello cat pushd stat rm
all: $(SHOBJ_STATUS)
@@ -148,6 +148,9 @@ rm: rm.o
fdflags: fdflags.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ fdflags.o $(SHOBJ_LIBS)
seq: seq.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ seq.o $(SHOBJ_LIBS)
logname: logname.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ logname.o $(SHOBJ_LIBS)
@@ -293,3 +296,5 @@ realpath.o: realpath.c
strftime.o: strftime.c
setpgid.o: setpgid.c
stat.o: stat.c
fdflags.o: fdflags.c
seq.o: seq.c
+2
View File
@@ -50,6 +50,7 @@ ln.c Make links.
loadables.h File loadable builtins can include for shell definitions.
logname.c Print login name of current user.
Makefile.in Simple makefile for the sample loadable builtins.
Makefile.inc.in Sample makefile to use for loadable builtin development.
mkdir.c Make directories.
mypid.c Add $MYPID variable, demonstrate use of unload hook functio.n
necho.c echo without options or argument interpretation.
@@ -60,6 +61,7 @@ push.c Anyone remember TOPS-20?
realpath.c Canonicalize pathnames, resolving symlinks.
rm.c Remove files and directories.
rmdir.c Remove directory.
seq.c Print a sequence of decimal or floating point numbers.
setpgid.c Set a process's pgrp; example of how to wrap a system call.
sleep.c sleep for fractions of a second.
stat.c populate an associative array with information about a file
+490
View File
@@ -0,0 +1,490 @@
/* seq - print sequence of numbers to standard output.
Copyright (C) 2018 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/>. */
/* Written as bash builtin by Chet Ramey. Portions from seq.c by Ulrich Drepper. */
#include <config.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdio.h>
#include <errno.h>
#include "bashansi.h"
#include "loadables.h"
#include "bashintl.h"
#ifndef errno
extern int errno;
#endif
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(STRTOLD_BROKEN)
typedef long double floatmax_t;
# define FLOATMAX_CONV "L"
# define strtofltmax strtold
# define FLOATMAX_FMT "%Lg"
# define FLOATMAX_WFMT "%0.Lf"
# define USE_LONG_DOUBLE
#else
typedef double floatmax_t;
# define FLOATMAX_CONV ""
# define strtofltmax strtod
# define FLOATMAX_FMT "%g"
# define FLOATMAX_WFMT "%0.f"
#endif
static floatmax_t getfloatmax __P((const char *));
static char *genformat __P((floatmax_t, floatmax_t, floatmax_t));
#define MAX(a, b) (((a) < (b))? (b) : (a))
static int conversion_error = 0;
/* If true print all number with equal width. */
static int equal_width;
/* The string used to separate two numbers. */
static char const *separator;
/* The string output after all numbers have been output. */
static char const terminator[] = "\n";
static char decimal_point;
/* Pretty much the same as the version in builtins/printf.def */
static floatmax_t
getfloatmax (arg)
const char *arg;
{
floatmax_t ret;
char *ep;
errno = 0;
ret = strtofltmax (arg, &ep);
if (*ep)
{
sh_invalidnum ((char *)arg);
conversion_error = 1;
}
else if (errno == ERANGE)
{
builtin_error ("warning: %s: %s", arg, strerror(ERANGE));
conversion_error = 1;
}
if (ret == -0.0)
ret = 0.0;
return (ret);
}
/* If FORMAT is a valid printf format for a double argument, return
its long double equivalent, allocated from dynamic storage. This
was written by Ulrich Drepper, taken from coreutils:seq.c */
static char *
long_double_format (char const *fmt)
{
size_t i;
size_t length_modifier_offset;
int has_L;
for (i = 0; ! (fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1)
{
if (!fmt[i])
{
builtin_error ("format %s has no %% directive", fmt);
return 0;
}
}
i++;
i += strspn (fmt + i, "-+#0 '"); /* zero or more flags */
i += strspn (fmt + i, "0123456789"); /* optional minimum field width */
if (fmt[i] == '.') /* optional precision */
{
i++;
i += strspn (fmt + i, "0123456789");
}
length_modifier_offset = i; /* optional length modifier */
/* we could ignore an 'l' length modifier here */
has_L = (fmt[i] == 'L');
i += has_L;
switch (fmt[i])
{
case '\0':
builtin_error ("format %s ends in %%", fmt);
return 0;
case 'A':
case 'a':
case 'e':
case 'E':
case 'f':
case 'F':
case 'g':
case 'G':
break;
default:
builtin_error ("format %s has unknown `%%%c' directive", fmt, fmt[i]);
return 0;
}
for (i++; ; i += (fmt[i] == '%') + 1)
if (fmt[i] == '%' && fmt[i + 1] != '%')
{
builtin_error ("format %s has too many %% directives", fmt);
return 0;
}
else if (fmt[i] == 0)
{
size_t format_size = i + 1;
char *ldfmt = xmalloc (format_size + 1);
memcpy (ldfmt, fmt, length_modifier_offset);
#ifdef USE_LONG_DOUBLE
ldfmt[length_modifier_offset] = 'L';
strcpy (ldfmt + length_modifier_offset + 1,
fmt + length_modifier_offset + has_L);
#else
strcpy (ldfmt + length_modifier_offset, fmt + length_modifier_offset)
#endif
return ldfmt;
}
}
/* Return the number of digits following the decimal point in NUMBUF */
static int
getprec (numbuf)
const char *numbuf;
{
int p;
char *dp;
if (dp = strchr (numbuf, decimal_point))
dp++; /* skip over decimal point */
for (p = 0; dp && *dp && ISDIGIT (*dp); dp++)
p++;
return p;
}
/* Return the default format given FIRST, INCR, and LAST. */
static char *
genformat (first, incr, last)
floatmax_t first, incr, last;
{
static char buf[6 + 2 * INT_STRLEN_BOUND (int)];
int wfirst, wlast, width;
int iprec, fprec, lprec, prec;
if (equal_width == 0)
return (FLOATMAX_FMT);
/* OK, we have to figure out the largest number of decimal places. This is
a little more expensive than using the original strings. */
snprintf (buf, sizeof (buf), FLOATMAX_FMT, incr);
iprec = getprec (buf);
wfirst = snprintf (buf, sizeof (buf), FLOATMAX_FMT, first);
fprec = getprec (buf);
prec = MAX (fprec, iprec);
wlast = snprintf (buf, sizeof (buf), FLOATMAX_FMT, last);
lprec = getprec (buf);
/* increase first width by any increased precision in increment */
wfirst += (prec - fprec);
/* adjust last width to use precision from first/incr */
wlast += (prec - lprec);
if (lprec && prec == 0)
wlast--; /* no decimal point */
if (lprec == 0 && prec)
wlast++; /* include decimal point */
if (fprec == 0 && prec)
wfirst++; /* include decimal point */
width = MAX (wfirst, wlast);
if (width)
sprintf (buf, "%%0%d.%d%sf", width, prec, FLOATMAX_CONV);
else
sprintf (buf, "%%.%d%sf", prec, FLOATMAX_CONV);
return buf;
}
int
print_fltseq (fmt, first, last, incr)
const char *fmt;
floatmax_t first, last, incr;
{
int n;
floatmax_t next;
const char *s;
n = 0; /* interation counter */
s = "";
for (next = first; incr >= 0 ? (next <= last) : (next >= last); next = first + n * incr)
{
QUIT;
if (*s && fputs (s, stdout) == EOF)
return (sh_chkwrite (EXECUTION_FAILURE));
if (printf (fmt, next) < 0)
return (sh_chkwrite (EXECUTION_FAILURE));
s = separator;
n++;
}
if (n > 0 && fputs (terminator, stdout) == EOF)
return (sh_chkwrite (EXECUTION_FAILURE));
return (sh_chkwrite (EXECUTION_SUCCESS));
}
/* must be <= INT_STRLEN_BOUND(intmax_t) */
int
width_needed (num)
intmax_t num;
{
int ret;
ret = num < 0; /* sign */
if (ret)
num = -num;
do
ret++;
while (num /= 10);
return ret;
}
int
print_intseq (ifirst, ilast, iincr)
intmax_t ifirst, ilast, iincr;
{
char intwfmt[6 + INT_STRLEN_BOUND(int) + sizeof (PRIdMAX)];
const char *s;
intmax_t i, next;
/* compute integer format string */
if (equal_width) /* -w supplied */
{
int wfirst, wlast, width;
wfirst = width_needed (ifirst);
wlast = width_needed (ilast);
width = MAX(wfirst, wlast);
/* The leading %s is for the separator */
snprintf (intwfmt, sizeof (intwfmt), "%%s%%0%u" PRIdMAX, width);
}
/* We could use braces.c:mkseq here but that allocates lots of memory */
s = "";
for (i = ifirst; (ifirst <= ilast) ? (i <= ilast) : (i >= ilast); i = next)
{
QUIT;
/* The leading %s is for the separator */
if (printf (equal_width ? intwfmt : "%s%" PRIdMAX, s, i) < 0)
return (sh_chkwrite (EXECUTION_FAILURE));
s = separator;
next = i + iincr;
}
if (fputs (terminator, stdout) == EOF)
return (sh_chkwrite (EXECUTION_FAILURE));
return (sh_chkwrite (EXECUTION_SUCCESS));
}
int
seq_builtin (list)
WORD_LIST *list;
{
floatmax_t first, last, incr;
intmax_t ifirst, ilast, iincr;
WORD_LIST *l;
int opt, nargs, intseq, freefmt;
char *first_str, *incr_str, *last_str;
char const *fmtstr; /* The printf(3) format used for output. */
equal_width = 0;
separator = "\n";
fmtstr = NULL;
first = 1.0;
last = 0.0;
incr = 0.0; /* set later */
ifirst = ilast = iincr = 0;
first_str = incr_str = last_str = 0;
intseq = freefmt = 0;
opt = 0;
reset_internal_getopt ();
while (opt != -1)
{
l = lcurrent ? lcurrent : list;
if (l && l->word && l->word->word && l->word->word[0] == '-' &&
(l->word->word[1] == '.' || DIGIT (l->word->word[1])))
{
loptend = l;
break; /* negative number */
}
if ((opt = internal_getopt (list, "f:s:w")) == -1)
break;
switch (opt)
{
case 'f':
fmtstr = list_optarg;
break;
case 's':
separator = list_optarg;
break;
case 'w':
equal_width = 1;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend;
if (list == 0)
{
builtin_usage ();
return (EXECUTION_FAILURE);
}
for (nargs = 1, l = list; l->next; l = l->next)
nargs++;
if (nargs > 3)
{
builtin_usage ();
return (EXECUTION_FAILURE);
}
/* LAST */
conversion_error = 0;
last = getfloatmax (last_str = l->word->word);
if (conversion_error)
return (EXECUTION_FAILURE);
/* FIRST LAST */
if (nargs > 1)
{
conversion_error = 0;
first = getfloatmax (first_str = list->word->word);
if (conversion_error)
return (EXECUTION_FAILURE);
}
/* FIRST INCR LAST */
if (nargs > 2)
{
conversion_error = 0;
incr = getfloatmax (incr_str = list->next->word->word);
if (conversion_error)
return (EXECUTION_FAILURE);
if (incr == 0.0)
{
builtin_error ("zero %screment", (first < last) ? "in" : "de");
return (EXECUTION_FAILURE);
}
}
/* Sanitize arguments */
if (incr == 0.0)
incr = (first <= last) ? 1.0 : -1.0;
if ((incr < 0.0 && first < last) || (incr > 0 && first > last))
{
builtin_error ("incorrect %screment", (first < last) ? "in" : "de");
return (EXECUTION_FAILURE);
}
/* validate format here */
if (fmtstr)
{
fmtstr = long_double_format (fmtstr);
freefmt = 1;
if (fmtstr == 0)
return (EXECUTION_FAILURE);
}
if (fmtstr != NULL && equal_width)
{
builtin_warning ("-w ignored when the format string is specified");
equal_width = 0;
}
/* Placeholder for later additional conditions */
if (last_str && all_digits (last_str) &&
(first_str == 0 || all_digits (first_str)) &&
(incr_str == 0 || all_digits (incr_str)) &&
fmtstr == NULL)
intseq = 1;
if (intseq)
{
ifirst = (intmax_t)first; /* truncation */
ilast = (intmax_t)last;
iincr = (intmax_t)incr;
return (print_intseq (ifirst, ilast, iincr));
}
decimal_point = locale_decpoint ();
if (fmtstr == NULL)
fmtstr = genformat (first, incr, last);
print_fltseq (fmtstr, first, last, incr);
if (freefmt)
free ((void *)fmtstr);
return sh_chkwrite (EXECUTION_SUCCESS);
}
/* Taken largely from GNU seq. */
char *seq_doc[] = {
"Print numbers from FIRST to LAST, in steps of INCREMENT.",
"",
"-f FORMAT use printf style floating-point FORMAT",
"-s STRING use STRING to separate numbers (default: \\n)",
"-w equalize width by padding with leading zeroes",
"",
"If FIRST or INCREMENT is omitted, it defaults to 1. However, an",
"omitted INCREMENT defaults to -1 when LAST is smaller than FIRST.",
"The sequence of numbers ends when the sum of the current number and",
"INCREMENT would become greater than LAST.",
"FIRST, INCREMENT, and LAST are interpreted as floating point values.",
"",
"FORMAT must be suitable for printing one argument of type 'double';",
"it defaults to %.PRECf if FIRST, INCREMENT, and LAST are all fixed point",
"decimal numbers with maximum precision PREC, and to %g otherwise.",
(char *)NULL
};
struct builtin seq_struct = {
"seq",
seq_builtin,
BUILTIN_ENABLED,
seq_doc,
"seq [-f format] [-s separator] [-w] [FIRST [INCR]] LAST",
0
};
+33 -13
View File
@@ -282,7 +282,7 @@ int line_number_for_err_trap;
int funcnest = 0;
int funcnest_max = 0;
int evalnest = 0; /* bash-4.4/bash-5.0 */
int evalnest = 0;
int evalnest_max = EVALNEST_MAX;
int sourcenest = 0;
@@ -624,7 +624,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
/* Fork a subshell, turn off the subshell bit, turn off job
control and call execute_command () on the command again. */
line_number_for_err_trap = line_number = command->value.Subshell->line; /* XXX - save value? */
if (command->type == cm_subshell)
line_number_for_err_trap = line_number = command->value.Subshell->line; /* XXX - save value? */
/* Otherwise we defer setting line_number */
tcmd = make_command_string (command);
paren_pid = make_child (p = savestring (tcmd), asynchronous);
@@ -748,7 +750,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
reap_procsubs ();
# endif
if (variable_context != 0)
if (variable_context != 0) /* XXX - also if sourcelevel != 0? */
{
ofifo = num_fifos ();
ofifo_list = copy_fifo_list ((int *)&osize);
@@ -1605,7 +1607,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
async_redirect_stdin ();
#if 0
/* bash-5.0 */
/* XXX - TAG: bash-5.1 */
if (user_subshell && command->type == cm_subshell)
optimize_subshell_command (command->value.Subshell->command);
#endif
@@ -2252,7 +2254,10 @@ coproc_setvars (cp)
{
v = find_variable_nameref_for_create (cp->c_name, 1);
if (v == INVALID_NAMEREF_VALUE)
return;
{
free (namevar);
return;
}
if (v && nameref_p (v))
{
free (cp->c_name);
@@ -2265,6 +2270,7 @@ coproc_setvars (cp)
{
if (readonly_p (v))
err_readonly (cp->c_name);
free (namevar);
return;
}
if (v == 0)
@@ -2349,10 +2355,9 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
invert = (command->flags & CMD_INVERT_RETURN) != 0;
/* XXX - expand coproc name without splitting -- bash-5.0 */
/* could make this dependent on a shopt option */
/* expand name without splitting - could make this dependent on a shopt option */
name = expand_string_unsplit_to_string (command->value.Coproc->name, 0);
/* Optional check -- bash-5.0. */
/* Optional check -- could be relaxed */
if (legal_identifier (name) == 0)
{
internal_error (_("`%s': not a valid identifier"), name);
@@ -2395,7 +2400,6 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
close (rpipe[1]);
close (wpipe[0]);
/* XXX - run Coproc->name through word expansion above -- bash-5.0 */
cp = coproc_alloc (command->value.Coproc->name, coproc_pid);
cp->c_rfd = rpipe[0];
cp->c_wfd = wpipe[1];
@@ -3469,8 +3473,20 @@ execute_case_command (case_command)
}
#endif
wlist = expand_word_unsplit (case_command->word, 0);
word = wlist ? string_list (wlist) : savestring ("");
/* Use the same expansions (the ones POSIX specifies) as the patterns;
dequote the resulting string (as POSIX specifies) since the quotes in
patterns are handled specially below. We have to do it in this order
because we're not supposed to perform word splitting. */
wlist = expand_word_leave_quoted (case_command->word, 0);
if (wlist)
{
char *t;
t = string_list (wlist);
word = dequote_string (t);
free (t);
}
else
word = savestring ("");
dispose_words (wlist);
retval = EXECUTION_SUCCESS;
@@ -4259,7 +4275,9 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
#endif
#endif
command_line = (char *)NULL; /* don't free this. */
#if 0
bind_lastarg ((char *)NULL);
#endif
return (result);
}
}
@@ -4665,8 +4683,10 @@ execute_builtin (builtin, words, flags, subshell)
/* `return' does a longjmp() back to a saved environment in execute_function.
If a variable assignment list preceded the command, and the shell is
running in POSIX mode, we need to merge that into the shell_variables
table, since `return' is a POSIX special builtin. */
if (posixly_correct && subshell == 0 && builtin == return_builtin && temporary_env)
table, since `return' is a POSIX special builtin. We don't do this if
it's being run by the `command' builtin, since that's supposed to inhibit
the special builtin properties. */
if (posixly_correct && subshell == 0 && builtin == return_builtin && (flags & CMD_COMMAND_BUILTIN) == 0 && temporary_env)
{
begin_unwind_frame ("return_temp_env");
add_unwind_protect (merge_temporary_env, (char *)NULL);
+30 -4
View File
@@ -26,8 +26,8 @@
order of decreasing precedence.
"id++", "id--" [post-increment and post-decrement]
"++id", "--id" [pre-increment and pre-decrement]
"-", "+" [(unary operators)]
"++id", "--id" [pre-increment and pre-decrement]
"!", "~"
"**" [(exponentiation)]
"*", "/", "%"
@@ -325,6 +325,9 @@ expr_bind_variable (lhs, rhs)
SHELL_VAR *v;
int aflags;
if (lhs == 0 || *lhs == 0)
return; /* XXX */
#if defined (ARRAY_VARS)
aflags = (assoc_expand_once && already_expanded) ? ASS_NOEXPAND : 0;
#else
@@ -337,6 +340,27 @@ expr_bind_variable (lhs, rhs)
}
#if defined (ARRAY_VARS)
/* This is similar to the logic in arrayfunc.c:valid_array_subscript when
you pass VA_NOEXPAND. */
static char *
expr_skipsubscript (vp, cp)
char *vp, *cp;
{
int flags, isassoc;
SHELL_VAR *entry;
isassoc = 0;
entry = 0;
if (assoc_expand_once & already_expanded)
{
*cp = '\0';
isassoc = legal_identifier (vp) && (entry = find_variable (vp)) && assoc_p (entry);
*cp = '['; /* ] */
}
flags = (isassoc && assoc_expand_once && already_expanded) ? VA_NOEXPAND : 0;
return (skipsubscript (cp, 0, flags));
}
/* Rewrite tok, which is of the form vname[expression], to vname[ind], where
IND is the already-calculated value of expression. */
static void
@@ -1012,7 +1036,8 @@ exp0 ()
expr_bind_array_element (curlval.tokstr, curlval.ind, vincdec);
else
#endif
expr_bind_variable (tokstr, vincdec);
if (tokstr)
expr_bind_variable (tokstr, vincdec);
}
free (vincdec);
val = v2;
@@ -1312,7 +1337,7 @@ readtok ()
#if defined (ARRAY_VARS)
if (c == '[')
{
e = skipsubscript (cp, 0, 1); /* XXX - arg 3 was 0 */
e = expr_skipsubscript (tp, cp); /* XXX - was skipsubscript */
if (cp[e] == ']')
{
cp += e + 1;
@@ -1434,7 +1459,8 @@ readtok ()
/* Could force parsing as preinc or predec and throw an error */
#if 0
{
/* bash-5.0 */
/* Posix says unary plus and minus have higher priority than
preinc and predec. */
/* This catches something like --4++ */
if (c == '-')
evalerror ("--: assignment requires lvalue");
+2
View File
@@ -79,6 +79,7 @@ posix_initialize (on)
interactive_comments = source_uses_path = expand_aliases = 1;
inherit_errexit = 1;
source_searches_cwd = 0;
print_shift_error = 1;
}
/* Things that should be turned on when posix mode is disabled. */
@@ -86,6 +87,7 @@ posix_initialize (on)
{
source_searches_cwd = 1;
expand_aliases = interactive_shell;
print_shift_error = 0;
}
}
+7 -3
View File
@@ -630,6 +630,8 @@ stop_pipeline (async, deferred)
pipeline_pgrp = 0;
newjob->flags = 0;
if (pipefail_opt)
newjob->flags |= J_PIPEFAIL;
/* Flag to see if in another pgrp. */
if (job_control)
@@ -688,7 +690,7 @@ stop_pipeline (async, deferred)
{
newjob->flags |= J_FOREGROUND;
/*
* !!!!! NOTE !!!!! (chet@ins.cwru.edu)
* !!!!! NOTE !!!!! (chet@po.cwru.edu)
*
* The currently-accepted job control wisdom says to set the
* terminal's process group n+1 times in an n-step pipeline:
@@ -2639,7 +2641,11 @@ raw_job_exit_status (job)
int fail;
WAIT ret;
#if 0
if (pipefail_opt)
#else
if (jobs[job]->flags & J_PIPEFAIL)
#endif
{
fail = 0;
p = jobs[job]->pipe;
@@ -2997,7 +3003,6 @@ if (job == NO_JOB)
{
s = job_signal_status (job);
/* XXX - bash-5.0 */
/* If we are non-interactive, but job control is enabled, and the job
died due to SIGINT, pretend we got the SIGINT */
if (job_control && IS_JOBCONTROL (job) && WIFSIGNALED (s) && WTERMSIG (s) == SIGINT)
@@ -3722,7 +3727,6 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc
}
/* Call a SIGCHLD trap handler for each child that exits, if one is set. */
/* XXX - bash-5.0 removes test for job_control */
if (children_exited &&
(signal_is_trapped (SIGCHLD) || trap_list[SIGCHLD] == (char *)IMPOSSIBLE_TRAP_HANDLER) &&
trap_list[SIGCHLD] != (char *)IGNORE_SIG)
+1
View File
@@ -103,6 +103,7 @@ typedef enum { JNONE = -1, JRUNNING = 1, JSTOPPED = 2, JDEAD = 4, JMIXED = 8 } J
#define J_NOHUP 0x08 /* Don't send SIGHUP to job if shell gets SIGHUP. */
#define J_STATSAVED 0x10 /* A process in this job had had status saved via $! */
#define J_ASYNC 0x20 /* Job was started asynchronously */
#define J_PIPEFAIL 0x40 /* pipefail set when job was started */
#define IS_FOREGROUND(j) ((jobs[j]->flags & J_FOREGROUND) != 0)
#define IS_NOTIFIED(j) ((jobs[j]->flags & J_NOTIFIED) != 0)
+2
View File
@@ -617,6 +617,8 @@ glob_vector (pat, dir, flags)
firstmalloc = 0;
nalloca = 0;
name_vector = NULL;
/*itrace("glob_vector: pat = `%s' dir = `%s' flags = 0x%x", pat, dir, flags);*/
/* If PAT is empty, skip the loop, but return one (empty) filename. */
if (pat == 0 || *pat == '\0')
+92 -13
View File
@@ -95,6 +95,9 @@ static const char *string_varname PARAMS((int));
static char *_rl_get_string_variable_value PARAMS((const char *));
static int substring_member_of_array PARAMS((const char *, const char * const *));
static int _rl_get_keymap_by_name PARAMS((const char *));
static int _rl_get_keymap_by_map PARAMS((Keymap));
static int currently_reading_init_file;
/* used only in this file */
@@ -2255,10 +2258,12 @@ glean_key_from_name (char *name)
}
/* Auxiliary functions to manage keymaps. */
static const struct {
const char * const name;
struct name_and_keymap {
char *name;
Keymap map;
} keymap_names[] = {
};
static struct name_and_keymap builtin_keymap_names[] = {
{ "emacs", emacs_standard_keymap },
{ "emacs-standard", emacs_standard_keymap },
{ "emacs-meta", emacs_meta_keymap },
@@ -2272,27 +2277,101 @@ static const struct {
{ (char *)0x0, (Keymap)0x0 }
};
Keymap
rl_get_keymap_by_name (const char *name)
/* -1 for NULL entry */
#define NUM_BUILTIN_KEYMAPS (sizeof (builtin_keymap_names) / sizeof (builtin_keymap_names[0]) - 1)
static struct name_and_keymap *keymap_names = builtin_keymap_names;
static int
_rl_get_keymap_by_name (const char *name)
{
register int i;
for (i = 0; keymap_names[i].name; i++)
if (_rl_stricmp (name, keymap_names[i].name) == 0)
return (keymap_names[i].map);
return ((Keymap) NULL);
return (i);
return -1;
}
Keymap
rl_get_keymap_by_name (const char *name)
{
int i;
i = _rl_get_keymap_by_name (name);
return ((i >= 0) ? keymap_names[i].map : (Keymap) NULL);
}
static int
_rl_get_keymap_by_map (Keymap map)
{
register int i;
for (i = 0; keymap_names[i].name; i++)
if (map == keymap_names[i].map)
return (i);
return -1;
}
char *
rl_get_keymap_name (Keymap map)
{
register int i;
for (i = 0; keymap_names[i].name; i++)
if (map == keymap_names[i].map)
return ((char *)keymap_names[i].name);
return ((char *)NULL);
int i;
i = _rl_get_keymap_by_map (map);
return ((i >= 0) ? keymap_names[i].name : (char *)NULL);
}
int
rl_set_keymap_name (const char *name, Keymap map)
{
int i, ni, mi;
/* First check whether or not we're trying to rename a builtin keymap */
mi = _rl_get_keymap_by_map (map);
if (mi >= 0 && mi < NUM_BUILTIN_KEYMAPS)
return -1;
/* Then reject attempts to set one of the builtin names to a new map */
ni = _rl_get_keymap_by_name (name);
if (ni >= 0 && ni < NUM_BUILTIN_KEYMAPS)
return -1;
/* Renaming a keymap we already added */
if (mi >= 0) /* XXX - could be >= NUM_BUILTIN_KEYMAPS */
{
xfree (keymap_names[mi].name);
keymap_names[mi].name = savestring (name);
return mi;
}
/* Associating new keymap with existing name */
if (ni >= 0)
{
keymap_names[ni].map = map;
return ni;
}
for (i = 0; keymap_names[i].name; i++)
;
if (keymap_names == builtin_keymap_names)
{
keymap_names = xmalloc ((i + 2) * sizeof (struct name_and_keymap));
memcpy (keymap_names, builtin_keymap_names, i * sizeof (struct name_and_keymap));
}
else
keymap_names = xrealloc (keymap_names, (i + 2) * sizeof (struct name_and_keymap));
keymap_names[i].name = savestring (name);
keymap_names[i].map = map;
keymap_names[i+1].name = NULL;
keymap_names[i+1].map = NULL;
return i;
}
void
rl_set_keymap (Keymap map)
{
+4 -4
View File
@@ -2873,14 +2873,14 @@ space_to_eol (int count)
void
_rl_clear_screen (void)
{
#ifndef __DJGPP__
#if defined (__DJGPP__)
ScreenClear ();
ScreenSetCursor (0, 0);
#else
if (_rl_term_clrpag)
tputs (_rl_term_clrpag, 1, _rl_output_character_function);
else
rl_crlf ();
#else
ScreenClear ();
ScreenSetCursor (0, 0);
#endif /* __DJGPP__ */
}
+15
View File
@@ -720,6 +720,21 @@ Return the name matching @var{keymap}. @var{name} is one which would
be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
@end deftypefun
@deftypefun void rl_set_keymap (const char *name, Keymap keymap)
Set the name of @var{keymap}. This name will then be "registered" and
available for use in a @code{set keymap} inputrc directive
@pxref{Readline Init File}).
The @var{name} may not be one of Readline's builtin names;
you may not add a different name for one of Readline's builtin keymaps.
Readline will make a copy of @var{name}.
You may replace the name associated with a given keymap by calling this
function two or more times with the same @var{keymap} argument.
You can associate a registered name with a new keymap by calling this
function two or more times with the same @var{name} argument.
There is no way to remove a named keymap once the name has been
registered.
@end deftypefun
@node Binding Keys
@subsection Binding Keys
+5 -1
View File
@@ -606,7 +606,7 @@ If this variable has not been given a value, the characters @key{ESC} and
@item keymap
@vindex keymap
Sets Readline's idea of the current keymap for key binding commands.
Acceptable @code{keymap} names are
Built-in @code{keymap} names are
@code{emacs},
@code{emacs-standard},
@code{emacs-meta},
@@ -617,6 +617,7 @@ Acceptable @code{keymap} names are
@code{vi-insert}.
@code{vi} is equivalent to @code{vi-command} (@code{vi-move} is also a
synonym); @code{emacs} is equivalent to @code{emacs-standard}.
Applications may add additional names.
The default value is @code{emacs}.
The value of the @code{editing-mode} variable also affects the
default keymap.
@@ -1850,6 +1851,9 @@ If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
If those searches do not result in a compspec, any compspec defined with
the @option{-D} option to @code{complete} is used as the default.
If there is no default compspec, Bash attempts alias expansion
on the command word as a final resort, and attempts to find a compspec
for the command word from any successful expansion
Once a compspec has been found, it is used to generate the list of
matching words.
+3 -3
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2018 Free Software Foundation, Inc.
@set EDITION 8.0
@set VERSION 8.0
@set UPDATED 6 July 2018
@set UPDATED-MONTH July 2018
@set UPDATED 18 September 2018
@set UPDATED-MONTH September 2018
@set LASTCHANGE Fri Jul 6 16:25:22 MDT 2018
@set LASTCHANGE Tue Sep 18 13:08:12 EDT 2018
+5 -3
View File
@@ -55,6 +55,8 @@
#define slashify_in_quotes "\\`\"$"
#define fielddelim(c) (whitespace(c) || (c) == '\n')
typedef int _hist_search_func_t PARAMS((const char *, int));
static char error_pointer;
@@ -769,7 +771,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
the last time. */
if (subst_bywords && si > we)
{
for (; temp[si] && whitespace (temp[si]); si++)
for (; temp[si] && fielddelim (temp[si]); si++)
;
ws = si;
we = history_tokenize_word (temp, si);
@@ -1446,7 +1448,7 @@ history_tokenize_word (const char *string, int ind)
i = ind;
delimiter = nestdelim = 0;
if (member (string[i], "()\n"))
if (member (string[i], "()\n")) /* XXX - included \n, but why? been here forever */
{
i++;
return i;
@@ -1604,7 +1606,7 @@ history_tokenize_internal (const char *string, int wind, int *indp)
for (i = result_index = size = 0, result = (char **)NULL; string[i]; )
{
/* Skip leading whitespace. */
for (; string[i] && whitespace (string[i]); i++)
for (; string[i] && fielddelim (string[i]); i++)
;
if (string[i] == 0 || string[i] == history_comment_char)
return (result);
+17 -3
View File
@@ -199,7 +199,7 @@ int
_hs_history_patsearch (const char *string, int direction, int flags)
{
char *pat;
size_t len;
size_t len, start;
int ret, unescaped_backslash;
#if defined (HAVE_FNMATCH)
@@ -216,12 +216,26 @@ _hs_history_patsearch (const char *string, int direction, int flags)
}
if (unescaped_backslash)
return -1;
pat = (char *)xmalloc (len + 2);
pat = (char *)xmalloc (len + 3);
/* If the search string is not anchored, we'll be calling fnmatch (assuming
we have it). Prefix a `*' to the front of the search string so we search
anywhere in the line. */
if ((flags & ANCHORED_SEARCH) == 0 && string[0] != '*')
{
pat[0] = '*';
start = 1;
len++;
}
else
{
start = 0;
}
/* Attempt to reduce the number of searches by tacking a `*' onto the end
of a pattern that doesn't have one. Assume a pattern that ends in a
backslash contains an even number of trailing backslashes; we check
above */
strcpy (pat, string);
strcpy (pat + start, string);
if (pat[len - 1] != '*')
{
pat[len] = '*'; /* XXX */
+16 -2
View File
@@ -102,15 +102,29 @@ static int rl_gather_tyi PARAMS((void));
/* Windows isatty returns true for every character device, including the null
device, so we need to perform additional checks. */
#if defined (_WIN32) && !defined (__CYGWIN__)
#include <conio.h>
#include <io.h>
#include <conio.h>
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
int
win32_isatty (int fd)
{
return (_isatty (fd) ? ((((long) (HANDLE) _get_osfhandle (fd)) & 3) == 3) : 0);
if (_isatty(fd))
{
HANDLE h;
DWORD ignored;
if ((h = (HANDLE) _get_osfhandle (fd)) == INVALID_HANDLE_VALUE)
{
errno = EBADF;
return 0;
}
if (GetConsoleMode (h, &ignored) != 0)
return 1;
}
errno = ENOTTY;
return 0;
}
#define isatty(x) win32_isatty(x)
+32 -5
View File
@@ -327,7 +327,10 @@ _rl_search_getchar (_rl_search_cxt *cxt)
int
_rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
{
int n, wstart, wlen, limit, cval;
int n, wstart, wlen, limit, cval, incr;
char *paste;
size_t pastelen;
int j;
rl_command_func_t *f;
f = (rl_command_func_t *)NULL;
@@ -398,6 +401,8 @@ add_character:
cxt->lastc = -5;
else if (c == CTRL ('Y') || f == rl_yank) /* XXX */
cxt->lastc = -6;
else if (f == rl_bracketed_paste_begin)
cxt->lastc = -7;
}
/* If we changed the keymap earlier while translating a key sequence into
@@ -620,22 +625,44 @@ add_character:
cxt->search_string[cxt->search_string_index] = '\0';
break;
case -7: /* bracketed paste */
paste = _rl_bracketed_text (&pastelen);
if (paste == 0 || *paste == 0)
{
free (paste);
break;
}
if (cxt->search_string_index + pastelen + 1 >= cxt->search_string_size)
{
cxt->search_string_size += pastelen + 2;
cxt->search_string = (char *)xrealloc (cxt->search_string, cxt->search_string_size);
}
strcpy (cxt->search_string + cxt->search_string_index, paste);
cxt->search_string_index += pastelen;
free (paste);
break;
/* Add character to search string and continue search. */
default:
if (cxt->search_string_index + 2 >= cxt->search_string_size)
#if defined (HANDLE_MULTIBYTE)
wlen = (cxt->mb[0] == 0 || cxt->mb[1] == 0) ? 1 : RL_STRLEN (cxt->mb);
#else
wlen = 1;
#endif
if (cxt->search_string_index + wlen + 1 >= cxt->search_string_size)
{
cxt->search_string_size += 128;
cxt->search_string_size += 128; /* 128 much greater than MB_CUR_MAX */
cxt->search_string = (char *)xrealloc (cxt->search_string, cxt->search_string_size);
}
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
int j, l;
int j;
if (cxt->mb[0] == 0 || cxt->mb[1] == 0)
cxt->search_string[cxt->search_string_index++] = cxt->mb[0];
else
for (j = 0, l = RL_STRLEN (cxt->mb); j < l; )
for (j = 0; j < wlen; )
cxt->search_string[cxt->search_string_index++] = cxt->mb[j++];
}
else
+3
View File
@@ -90,6 +90,9 @@ extern Keymap rl_get_keymap PARAMS((void));
/* Set the current keymap to MAP. */
extern void rl_set_keymap PARAMS((Keymap));
/* Set the name of MAP to NAME */
extern int rl_set_keymap_name PARAMS((const char *, Keymap));
#ifdef __cplusplus
}
#endif
+19 -5
View File
@@ -670,16 +670,16 @@ rl_yank_last_arg (int count, int key)
`bracketed paste' sequence, read the rest of the pasted input until the
closing sequence and insert the pasted text as a single unit without
interpretation. */
int
rl_bracketed_paste_begin (int count, int key)
char *
_rl_bracketed_text (size_t *lenp)
{
int retval, c;
int c;
size_t len, cap;
char *buf;
retval = 0;
len = 0;
buf = xmalloc (cap = 64);
buf[0] = '\0';
RL_SETSTATE (RL_STATE_MOREINPUT);
while ((c = rl_read_key ()) >= 0)
@@ -708,9 +708,23 @@ rl_bracketed_paste_begin (int count, int key)
if (len == cap)
buf = xrealloc (buf, cap + 1);
buf[len] = '\0';
retval = rl_insert_text (buf) == len ? 0 : 1;
}
if (lenp)
*lenp = len;
return (buf);
}
int
rl_bracketed_paste_begin (int count, int key)
{
int retval, c;
size_t len, cap;
char *buf;
buf = _rl_bracketed_text (&len);
retval = rl_insert_text (buf) == len ? 0 : 1;
xfree (buf);
return (retval);
}
+3
View File
@@ -357,6 +357,9 @@ extern Keymap rl_get_keymap_by_name PARAMS((const char *));
extern char *rl_get_keymap_name PARAMS((Keymap));
extern void rl_set_keymap PARAMS((Keymap));
extern Keymap rl_get_keymap PARAMS((void));
extern int rl_set_keymap_name PARAMS((const char *, Keymap));
/* Undocumented; used internally only. */
extern void rl_set_keymap_from_edit_mode PARAMS((void));
extern char *rl_get_keymap_name_from_edit_mode PARAMS((void));
+2
View File
@@ -309,6 +309,8 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
#define BRACK_PASTE_INIT "\033[?2004h"
#define BRACK_PASTE_FINI "\033[?2004l\r"
extern char *_rl_bracketed_text PARAMS((size_t *));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
extern int _rl_peek_macro_key PARAMS((void));
-1
View File
@@ -396,7 +396,6 @@ save_tty_chars (TIOTYPE *tiop)
/* Currently this is only used on AIX */
static void
rltty_warning (char *msg)
char *msg;
{
_rl_errmsg ("warning: %s", msg);
}
+1 -1
View File
@@ -135,7 +135,7 @@ noninc_search_from_pos (char *string, int pos, int dir, int flags, int *ncp)
sflags |= ANCHORED_SEARCH;
s++;
}
ret = _hs_history_patsearch (string, dir, sflags);
ret = _hs_history_patsearch (s, dir, sflags);
}
else if (*string == '^')
ret = history_search_prefix (string + 1, dir);
+1
View File
@@ -595,6 +595,7 @@ bind_termcap_arrow_keys (Keymap map)
rl_bind_keyseq_if_unbound (_rl_term_at7, rl_end_of_line); /* End */
rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete);
rl_bind_keyseq_if_unbound (_rl_term_kI, rl_overwrite_mode); /* Insert */
_rl_keymap = xkeymap;
}
+26 -1
View File
@@ -51,6 +51,8 @@
extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
int _rl_doing_an_undo = 0;
@@ -166,7 +168,7 @@ _rl_copy_undo_list (UNDO_LIST *head)
int
rl_do_undo (void)
{
UNDO_LIST *release;
UNDO_LIST *release, *search;
int waiting_for_begin, start, end;
HIST_ENTRY *cur, *temp;
@@ -223,6 +225,7 @@ rl_do_undo (void)
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
release->next = 0; /* XXX */
/* If we are editing a history entry, make sure the change is replicated
in the history entry's line */
@@ -235,8 +238,30 @@ rl_do_undo (void)
xfree (temp);
}
/* Make sure there aren't any history entries with that undo list */
_hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
/* And make sure this list isn't anywhere in the saved line for history */
if (_rl_saved_line_for_history && _rl_saved_line_for_history->data)
{
/* Brute force; no finesse here */
search = (UNDO_LIST *)_rl_saved_line_for_history->data;
if (search == release)
_rl_saved_line_for_history->data = rl_undo_list;
else
{
while (search->next)
{
if (search->next == release)
{
search->next = rl_undo_list;
break;
}
search = search->next;
}
}
}
xfree (release);
}
while (waiting_for_begin);
+1
View File
@@ -198,6 +198,7 @@ void
rl_vi_start_inserting (int key, int repeat, int sign)
{
_rl_vi_set_last (key, repeat, sign);
rl_begin_undo_group (); /* ensure inserts aren't concatenated */
rl_vi_insertion_mode (1, key);
}
+1 -1
View File
@@ -227,7 +227,7 @@ sh_canonpath (path, flags)
if (result[2] == '\0') /* short-circuit for bare `//' */
result[1] = '\0';
else
strcpy (result, result + 1);
memmove (result, result + 1, strlen (result + 1) + 1);
}
return (result);
+1 -1
View File
@@ -245,7 +245,7 @@ error:
if (result[2] == '\0') /* short-circuit for bare `//' */
result[1] = '\0';
else
strcpy (result, result + 1);
memmove (result, result + 1, strlen (result + 1) + 1);
}
return (result);
+3 -1
View File
@@ -2544,6 +2544,7 @@ next_alias_char:
reading a quoted string. */
#ifndef OLD_ALIAS_HACK
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
pushed_string_list->flags != PSH_DPAREN &&
shell_input_line_index > 0 &&
shell_input_line[shell_input_line_index-1] != ' ' &&
shell_input_line[shell_input_line_index-1] != '\n' &&
@@ -2555,6 +2556,7 @@ next_alias_char:
#endif
pop_alias:
/* This case works for PSH_DPAREN as well */
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
{
pop_string ();
@@ -3031,7 +3033,7 @@ special_case_tokens (tokstr)
return (IN);
}
/* bash-5.0: leaving above code intact for now, but it should eventually be
/* XXX - leaving above code intact for now, but it should eventually be
removed in favor of this clause. */
/* Posix grammar rule 6 */
if (expecting_in_token && (last_read_token == WORD || last_read_token == '\n') &&
+1 -1
View File
@@ -151,7 +151,7 @@ static int progcomp_debug = 0;
int prog_completion_enabled = 1;
#ifdef ALIAS /* bash-5.0-beta */
#ifdef ALIAS
int progcomp_alias = 0; /* unavailable to user code for now */
#endif
BIN
View File
Binary file not shown.
+239 -224
View File
File diff suppressed because it is too large Load Diff
+186 -182
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+231 -215
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+229 -213
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+229 -213
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+224 -213
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+837 -578
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+226 -213
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+236 -221
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+236 -221
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+229 -213
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+920 -630
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+230 -220
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+227 -215
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+230 -213
View File
File diff suppressed because it is too large Load Diff

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