better parser error messages; add -p option to source builtin

This commit is contained in:
Chet Ramey
2024-06-21 10:38:39 -04:00
parent dbb48b9786
commit 886e4e68be
17 changed files with 2057 additions and 1912 deletions
+20
View File
@@ -9626,3 +9626,23 @@ parse.y
- cond_term: if we read a WORD where we expect something else, dispose - cond_term: if we read a WORD where we expect something else, dispose
of the WORD_DESC before returning COND_ERROR of the WORD_DESC before returning COND_ERROR
Report and patch from Grisha Levit <grishalevit@gmail.com> Report and patch from Grisha Levit <grishalevit@gmail.com>
6/10
----
parse.y
- cond_term: if we read a WORD when expecting a close paren, dispose
of the WORD_DESC before returning COND_ERROR
- error_token_from_token: use the TOK argument instead of
current_token if we can't find the token as a reserved word or
symbol
6/12
----
builtins/source.def
- source_builtin: add -p PATH option, searches PATH argument instead
of $PATH; overrides sourcepath; does not search $PWD if path search
fails
doc/bash.1,doc/bashref.texi
- source: document -p
+1
View File
@@ -1047,6 +1047,7 @@ tests/source4.sub f
tests/source5.sub f tests/source5.sub f
tests/source6.sub f tests/source6.sub f
tests/source7.sub f tests/source7.sub f
tests/source8.sub f
tests/case.tests f tests/case.tests f
tests/case.right f tests/case.right f
tests/case1.sub f tests/case1.sub f
+43 -34
View File
@@ -1,7 +1,7 @@
This file is source.def, from which is created source.c. This file is source.def, from which is created source.c.
It implements the builtins "." and "source" in Bash. It implements the builtins "." and "source" in Bash.
Copyright (C) 1987-2023 Free Software Foundation, Inc. Copyright (C) 1987-2024 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell. This file is part of GNU Bash, the Bourne Again SHell.
@@ -22,13 +22,14 @@ $PRODUCES source.c
$BUILTIN source $BUILTIN source
$FUNCTION source_builtin $FUNCTION source_builtin
$SHORT_DOC source filename [arguments] $SHORT_DOC source [-p path] filename [arguments]
Execute commands from a file in the current shell. Execute commands from a file in the current shell.
Read and execute commands from FILENAME in the current shell. The Read and execute commands from FILENAME in the current shell. If the
entries in $PATH are used to find the directory containing FILENAME. -p option is supplied, the PATH argument is treated as a colon-
If any ARGUMENTS are supplied, they become the positional parameters separated list of directories to search for FILENAME. If -p is not
when FILENAME is executed. supplied, $PATH is searched to find FILENAME. If any ARGUMENTS are
supplied, they become the positional parameters when FILENAME is executed.
Exit Status: Exit Status:
Returns the status of the last command executed in FILENAME; fails if Returns the status of the last command executed in FILENAME; fails if
@@ -38,13 +39,14 @@ $END
$BUILTIN . $BUILTIN .
$DOCNAME dot $DOCNAME dot
$FUNCTION source_builtin $FUNCTION source_builtin
$SHORT_DOC . filename [arguments] $SHORT_DOC . [-p path] filename [arguments]
Execute commands from a file in the current shell. Execute commands from a file in the current shell.
Read and execute commands from FILENAME in the current shell. The Read and execute commands from FILENAME in the current shell. If the
entries in $PATH are used to find the directory containing FILENAME. -p option is supplied, the PATH argument is treated as a colon-
If any ARGUMENTS are supplied, they become the positional parameters separated list of directories to search for FILENAME. If -p is not
when FILENAME is executed. supplied, $PATH is searched to find FILENAME. If any ARGUMENTS are
supplied, they become the positional parameters when FILENAME is executed.
Exit Status: Exit Status:
Returns the status of the last command executed in FILENAME; fails if Returns the status of the last command executed in FILENAME; fails if
@@ -82,7 +84,8 @@ extern int errno;
static void uw_maybe_pop_dollar_vars (void *); static void uw_maybe_pop_dollar_vars (void *);
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */ /* If non-zero, `.' uses $PATH to look up the script to be sourced when -p is
not supplied. */
int source_uses_path = 1; int source_uses_path = 1;
/* If non-zero, `.' looks in the current directory if the filename argument /* If non-zero, `.' looks in the current directory if the filename argument
@@ -115,11 +118,24 @@ uw_maybe_pop_dollar_vars (void *ignore)
int int
source_builtin (WORD_LIST *list) source_builtin (WORD_LIST *list)
{ {
int result, search_cwd; int result, search_cwd, opt;
char *filename, *debug_trap, *x; char *filename, *debug_trap, *x, *pathstring;
if (no_options (list)) pathstring = 0;
return (EX_USAGE); reset_internal_getopt ();
while ((opt = internal_getopt (list, "p:")) != -1)
{
switch (opt)
{
case 'p':
pathstring = list_optarg;
break;
CASE_HELPOPT;
default:
builtin_usage ();
return (EX_USAGE);
}
}
list = loptend; list = loptend;
if (list == 0) if (list == 0)
@@ -130,14 +146,19 @@ source_builtin (WORD_LIST *list)
} }
#if defined (RESTRICTED_SHELL) #if defined (RESTRICTED_SHELL)
if (restricted && strchr (list->word->word, '/')) if (restricted && (pathstring || strchr (list->word->word, '/')))
{ {
sh_restricted (list->word->word); sh_restricted (list->word->word);
return (EXECUTION_FAILURE); return (EXECUTION_FAILURE);
} }
#endif #endif
search_cwd = source_searches_cwd; /* normalize pathstring */
if (pathstring && *pathstring == 0)
pathstring = ".";
/* XXX - If we supply -p PATH, don't default to searching $PWD */
search_cwd = pathstring == 0 && source_searches_cwd;
filename = (char *)NULL; filename = (char *)NULL;
/* XXX -- should this be absolute_pathname? */ /* XXX -- should this be absolute_pathname? */
@@ -145,23 +166,11 @@ source_builtin (WORD_LIST *list)
filename = savestring (list->word->word); filename = savestring (list->word->word);
else if (absolute_pathname (list->word->word)) else if (absolute_pathname (list->word->word))
filename = savestring (list->word->word); filename = savestring (list->word->word);
else if (pathstring)
filename = find_in_path (list->word->word, pathstring, FS_READABLE);
else if (source_uses_path) else if (source_uses_path)
{ filename = find_path_file (list->word->word);
#if 0
char *spath;
#if defined (RESTRICTED_SHELL)
if (restricted == 0 && posixly_correct == 0 && (spath = path_value ("BASH_SOURCE_PATH", 1)))
#else
if (posixly_correct == 0 && (spath = path_value ("BASH_SOURCE_PATH", 1)))
#endif
{
filename = find_in_path (list->word->word, spath, FS_READABLE);
search_cwd = 0;
}
else
#endif
filename = find_path_file (list->word->word);
}
if (filename == 0) if (filename == 0)
{ {
if (search_cwd == 0) if (search_cwd == 0)
+605 -596
View File
File diff suppressed because it is too large Load Diff
+22 -25
View File
@@ -5,14 +5,14 @@
.\" Case Western Reserve University .\" Case Western Reserve University
.\" chet.ramey@case.edu .\" chet.ramey@case.edu
.\" .\"
.\" Last Change: Sat May 11 12:44:30 EDT 2024 .\" Last Change: Wed Jun 12 10:31:44 PDT 2024
.\" .\"
.\" bash_builtins, strip all but Built-Ins section .\" bash_builtins, strip all but Built-Ins section
.\" avoid a warning about an undefined register .\" avoid a warning about an undefined register
.\" .if !rzY .nr zY 0 .\" .if !rzY .nr zY 0
.if \n(zZ=1 .ig zZ .if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY .if \n(zY=1 .ig zY
.TH BASH 1 "2024 May 11" "GNU Bash 5.3" .TH BASH 1 "2024 June 12" "GNU Bash 5.3"
.\" .\"
.ie \n(.g \{\ .ie \n(.g \{\
.ds ' \(aq .ds ' \(aq
@@ -8054,44 +8054,40 @@ and performing any specified
redirections. redirections.
The return status is zero. The return status is zero.
.TP .TP
\fB\&.\| \fP \fIfilename\fP [\fIarguments\fP] \fB\&.\| \fP [\fB\-p\fP \fIpath\fP] \fIfilename\fP [\fIarguments\fP]
.PD 0 .PD 0
.TP .TP
\fBsource\fP \fIfilename\fP [\fIarguments\fP] \fBsource\fP [\fB\-p\fP \fIpath\fP] \fIfilename\fP [\fIarguments\fP]
.PD .PD
Read and execute commands from The \fB\&.\| \fP command (\fBsource\fP) reads and execute commands from
.I filename .I filename
in the current in the current shell environment and returns the exit status of the
shell environment and return the exit status of the last command last command executed from
executed from
.IR filename . .IR filename .
If If \fIfilename\fP does not contain a slash, \fB\&.\| \fP searchs for it.
.I filename If the \fB\-p\fP option is supplied, \fB\&.\| \fP treats \fIpath\fP
does not contain a slash, filenames in as a colon-separated list of directories in which to find \fIfilename\fP;
otherwise, \fB\&.\| \fP uses the entries in
.SM .SM
.B PATH .B PATH
are used to find the directory containing to find the directory containing
.IR filename , .IR filename .
but \fIfilename\fP does not need to be executable. \fIfilename\fP does not need to be executable.
The file searched for in
.SM
.B PATH
need not be executable.
When \fBbash\fP is not in \fIposix mode\fP, it searches When \fBbash\fP is not in \fIposix mode\fP, it searches
the current directory if no file is found in the current directory if no file is found in
.SM .SM
.BR PATH . .BR PATH ,
but does not search the current directory if \fB\-p\fP is supplied.
If the If the
.B sourcepath .B sourcepath
option to the option to the
.B shopt .B shopt
builtin command is turned off, the builtin command is turned off, \fB\&.\| \fP does not search
.SM .SM
.B PATH .BR PATH .
is not searched.
If any \fIarguments\fP are supplied, they become the positional If any \fIarguments\fP are supplied, they become the positional
parameters when \fIfilename\fP is executed. Otherwise the positional parameters when \fIfilename\fP is executed.
parameters are unchanged. Otherwise the positional parameters are unchanged.
If the \fB\-T\fP option is enabled, \fB.\fP inherits any trap on If the \fB\-T\fP option is enabled, \fB.\fP inherits any trap on
\fBDEBUG\fP; if it is not, any \fBDEBUG\fP trap string is saved and \fBDEBUG\fP; if it is not, any \fBDEBUG\fP trap string is saved and
restored around the call to \fB.\fP, and \fB.\fP unsets the restored around the call to \fB.\fP, and \fB.\fP unsets the
@@ -11202,7 +11198,8 @@ If set, the
\fB.\fP (\fBsource\fP) builtin uses the value of \fB.\fP (\fBsource\fP) builtin uses the value of
.SM .SM
.B PATH .B PATH
to find the directory containing the file supplied as an argument. to find the directory containing the file supplied as an argument when
the \fB\-p\fP option is not supplied.
This option is enabled by default. This option is enabled by default.
.TP 8 .TP 8
.B varredir_close .B varredir_close
+222 -213
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 7.1 from bashref.texi. This is bash.info, produced by makeinfo version 7.1 from bashref.texi.
This text is a brief description of the features that are present in the This text is a brief description of the features that are present in the
Bash shell (version 5.3, 23 April 2024). Bash shell (version 5.3, 12 June 2024).
This is Edition 5.3, last updated 23 April 2024, of The GNU Bash This is Edition 5.3, last updated 12 June 2024, of The GNU Bash
Reference Manual, for Bash, Version 5.3. Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2023 Free Software Foundation, Inc. Copyright © 1988-2023 Free Software Foundation, Inc.
@@ -26,10 +26,10 @@ Bash Features
************* *************
This text is a brief description of the features that are present in the This text is a brief description of the features that are present in the
Bash shell (version 5.3, 23 April 2024). The Bash home page is Bash shell (version 5.3, 12 June 2024). The Bash home page is
<http://www.gnu.org/software/bash/>. <http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 23 April 2024, of The GNU Bash This is Edition 5.3, last updated 12 June 2024, of The GNU Bash
Reference Manual, for Bash, Version 5.3. Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some Bash contains features that appear in other popular shells, and some
@@ -991,9 +991,8 @@ File: bash.info, Node: Conditional Constructs, Next: Command Grouping, Prev:
and filename expansion. The shell performs tilde expansion, and filename expansion. The shell performs tilde expansion,
parameter and variable expansion, arithmetic expansion, command parameter and variable expansion, arithmetic expansion, command
substitution, process substitution, and quote removal on those substitution, process substitution, and quote removal on those
words (the expansions that would occur if the words were enclosed words. Conditional operators such as -f must be unquoted to be
in double quotes). Conditional operators such as -f must be recognized as primaries.
unquoted to be recognized as primaries.
When used with [[, the < and > operators sort When used with [[, the < and > operators sort
lexicographically using the current locale. lexicographically using the current locale.
@@ -3280,24 +3279,28 @@ standard.
The return status is zero. The return status is zero.
. (a period) . (a period)
. FILENAME [ARGUMENTS] . [-p PATH] FILENAME [ARGUMENTS]
Read and execute commands from the FILENAME argument in the current Read and execute commands from the FILENAME argument in the current
shell context. If FILENAME does not contain a slash, the PATH shell context. If FILENAME does not contain a slash, . searches
variable is used to find FILENAME, but FILENAME does not need to be for it. If -p is supplied, . treats PATH as a colon-separated
executable. When Bash is not in POSIX mode, it searches the list of directories in which to find FILENAME; otherwise, . uses
current directory if FILENAME is not found in $PATH. If any the directories in PATH to find FILENAME. FILENAME does not need
ARGUMENTS are supplied, they become the positional parameters when to be executable. When Bash is not in POSIX mode, it searches the
FILENAME is executed. Otherwise the positional parameters are current directory if FILENAME is not found in $PATH, but does not
unchanged. If the -T option is enabled, . inherits any trap on search the current directory if -p is supplied. If the
DEBUG; if it is not, any DEBUG trap string is saved and sourcepath option (*note The Shopt Builtin::) is turned off .
restored around the call to ., and . unsets the DEBUG trap does not search PATH. If any ARGUMENTS are supplied, they become
while it executes. If -T is not set, and the sourced file the positional parameters when FILENAME is executed. Otherwise the
changes the DEBUG trap, the new value is retained when . positional parameters are unchanged. If the -T option is
completes. The return status is the exit status of the last enabled, . inherits any trap on DEBUG; if it is not, any
command executed, or zero if no commands are executed. If FILENAME DEBUG trap string is saved and restored around the call to .,
is not found, or cannot be read, the return status is non-zero. and . unsets the DEBUG trap while it executes. If -T is not
This builtin is equivalent to source. set, and the sourced file changes the DEBUG trap, the new value
is retained when . completes. The return status is the exit
status of the last command executed, or zero if no commands are
executed. If FILENAME is not found, or cannot be read, the return
status is non-zero. This builtin is equivalent to source.
break break
break [N] break [N]
@@ -4396,7 +4399,7 @@ standard.
A synonym for mapfile. A synonym for mapfile.
source source
source FILENAME source [-p PATH] FILENAME [ARGUMENTS]
A synonym for . (*note Bourne Shell Builtins::). A synonym for . (*note Bourne Shell Builtins::).
@@ -5223,8 +5226,9 @@ This builtin allows you to change additional shell optional behavior.
sourcepath sourcepath
If set, the . (source) builtin uses the value of PATH to If set, the . (source) builtin uses the value of PATH to
find the directory containing the file supplied as an find the directory containing the file supplied as an argument
argument. This option is enabled by default. when the -p option is not supplied. This option is enabled
by default.
varredir_close varredir_close
If set, the shell automatically closes file descriptors If set, the shell automatically closes file descriptors
@@ -5729,7 +5733,7 @@ Variables::).
A sort specifier of nosort disables sorting completely; the A sort specifier of nosort disables sorting completely; the
results are returned in the order they are read from the file results are returned in the order they are read from the file
system,. system, and any leading - is ignored.
If the sort specifier is missing, it defaults to NAME, so a value If the sort specifier is missing, it defaults to NAME, so a value
of + is equivalent to the null string, and a value of - sorts of + is equivalent to the null string, and a value of - sorts
@@ -9096,10 +9100,12 @@ File: bash.info, Node: Commands For Moving, Next: Commands For History, Up: B
------------------------- -------------------------
beginning-of-line (C-a) beginning-of-line (C-a)
Move to the start of the current line. Move to the start of the current line. This may also be bound to
the Home key on some keyboards.
end-of-line (C-e) end-of-line (C-e)
Move to the end of the line. Move to the end of the line. This may also be bound to the End key
on some keyboards.
forward-char (C-f) forward-char (C-f)
Move forward a character. Move forward a character.
@@ -9200,26 +9206,28 @@ File: bash.info, Node: Commands For History, Next: Commands For Text, Prev: C
a string supplied by the user. The search string may match a string supplied by the user. The search string may match
anywhere in a history line. anywhere in a history line.
history-search-forward ()
Search forward through the history for the string of characters
between the start of the current line and the point. The search
string must match at the beginning of a history line. This is a
non-incremental search. By default, this command is unbound.
history-search-backward () history-search-backward ()
Search backward through the history for the string of characters Search backward through the history for the string of characters
between the start of the current line and the point. The search between the start of the current line and the point. The search
string must match at the beginning of a history line. This is a string must match at the beginning of a history line. This is a
non-incremental search. By default, this command is unbound. non-incremental search. By default, this command is unbound, but
may be bound to the Page Down key on some keyboards.
history-substring-search-forward () history-search-forward ()
Search forward through the history for the string of characters Search forward through the history for the string of characters
between the start of the current line and the point. The search between the start of the current line and the point. The search
string must match at the beginning of a history line. This is a
non-incremental search. By default, this command is unbound, but
may be bound to the Page Up key on some keyboards.
history-substring-search-backward ()
Search backward through the history for the string of characters
between the start of the current line and the point. The search
string may match anywhere in a history line. This is a string may match anywhere in a history line. This is a
non-incremental search. By default, this command is unbound. non-incremental search. By default, this command is unbound.
history-substring-search-backward () history-substring-search-forward ()
Search backward through the history for the string of characters Search forward through the history for the string of characters
between the start of the current line and the point. The search between the start of the current line and the point. The search
string may match anywhere in a history line. This is a string may match anywhere in a history line. This is a
non-incremental search. By default, this command is unbound. non-incremental search. By default, this command is unbound.
@@ -9346,7 +9354,8 @@ File: bash.info, Node: Commands For Text, Next: Commands For Killing, Prev: C
Characters bound to backward-delete-char replace the character Characters bound to backward-delete-char replace the character
before point with a space. before point with a space.
By default, this command is unbound. By default, this command is unbound, but may be bound to the Insert
key on some keyboards.
 
File: bash.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands File: bash.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
@@ -12213,17 +12222,17 @@ D.1 Index of Shell Builtin Commands
* .: Bourne Shell Builtins. * .: Bourne Shell Builtins.
(line 17) (line 17)
* [: Bourne Shell Builtins. * [: Bourne Shell Builtins.
(line 285) (line 289)
* alias: Bash Builtins. (line 11) * alias: Bash Builtins. (line 11)
* bg: Job Control Builtins. * bg: Job Control Builtins.
(line 7) (line 7)
* bind: Bash Builtins. (line 21) * bind: Bash Builtins. (line 21)
* break: Bourne Shell Builtins. * break: Bourne Shell Builtins.
(line 37) (line 41)
* builtin: Bash Builtins. (line 124) * builtin: Bash Builtins. (line 124)
* caller: Bash Builtins. (line 133) * caller: Bash Builtins. (line 133)
* cd: Bourne Shell Builtins. * cd: Bourne Shell Builtins.
(line 45) (line 49)
* command: Bash Builtins. (line 150) * command: Bash Builtins. (line 150)
* compgen: Programmable Completion Builtins. * compgen: Programmable Completion Builtins.
(line 12) (line 12)
@@ -12232,7 +12241,7 @@ D.1 Index of Shell Builtin Commands
* compopt: Programmable Completion Builtins. * compopt: Programmable Completion Builtins.
(line 248) (line 248)
* continue: Bourne Shell Builtins. * continue: Bourne Shell Builtins.
(line 90) (line 94)
* declare: Bash Builtins. (line 170) * declare: Bash Builtins. (line 170)
* dirs: Directory Stack Builtins. * dirs: Directory Stack Builtins.
(line 7) (line 7)
@@ -12241,23 +12250,23 @@ D.1 Index of Shell Builtin Commands
* echo: Bash Builtins. (line 273) * echo: Bash Builtins. (line 273)
* enable: Bash Builtins. (line 322) * enable: Bash Builtins. (line 322)
* eval: Bourne Shell Builtins. * eval: Bourne Shell Builtins.
(line 99) (line 103)
* exec: Bourne Shell Builtins. * exec: Bourne Shell Builtins.
(line 107) (line 111)
* exit: Bourne Shell Builtins. * exit: Bourne Shell Builtins.
(line 125) (line 129)
* export: Bourne Shell Builtins. * export: Bourne Shell Builtins.
(line 132) (line 136)
* false: Bourne Shell Builtins. * false: Bourne Shell Builtins.
(line 148) (line 152)
* fc: Bash History Builtins. * fc: Bash History Builtins.
(line 10) (line 10)
* fg: Job Control Builtins. * fg: Job Control Builtins.
(line 17) (line 17)
* getopts: Bourne Shell Builtins. * getopts: Bourne Shell Builtins.
(line 153) (line 157)
* hash: Bourne Shell Builtins. * hash: Bourne Shell Builtins.
(line 197) (line 201)
* help: Bash Builtins. (line 360) * help: Bash Builtins. (line 360)
* history: Bash History Builtins. * history: Bash History Builtins.
(line 46) (line 46)
@@ -12275,36 +12284,36 @@ D.1 Index of Shell Builtin Commands
* pushd: Directory Stack Builtins. * pushd: Directory Stack Builtins.
(line 69) (line 69)
* pwd: Bourne Shell Builtins. * pwd: Bourne Shell Builtins.
(line 222) (line 226)
* read: Bash Builtins. (line 523) * read: Bash Builtins. (line 523)
* readarray: Bash Builtins. (line 629) * readarray: Bash Builtins. (line 629)
* readonly: Bourne Shell Builtins. * readonly: Bourne Shell Builtins.
(line 232) (line 236)
* return: Bourne Shell Builtins. * return: Bourne Shell Builtins.
(line 251) (line 255)
* set: The Set Builtin. (line 11) * set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins. * shift: Bourne Shell Builtins.
(line 272) (line 276)
* shopt: The Shopt Builtin. (line 9) * shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 638) * source: Bash Builtins. (line 638)
* suspend: Job Control Builtins. * suspend: Job Control Builtins.
(line 116) (line 116)
* test: Bourne Shell Builtins. * test: Bourne Shell Builtins.
(line 285) (line 289)
* times: Bourne Shell Builtins. * times: Bourne Shell Builtins.
(line 387) (line 391)
* trap: Bourne Shell Builtins. * trap: Bourne Shell Builtins.
(line 393) (line 397)
* true: Bourne Shell Builtins. * true: Bourne Shell Builtins.
(line 455) (line 459)
* type: Bash Builtins. (line 643) * type: Bash Builtins. (line 643)
* typeset: Bash Builtins. (line 681) * typeset: Bash Builtins. (line 681)
* ulimit: Bash Builtins. (line 687) * ulimit: Bash Builtins. (line 687)
* umask: Bourne Shell Builtins. * umask: Bourne Shell Builtins.
(line 460) (line 464)
* unalias: Bash Builtins. (line 793) * unalias: Bash Builtins. (line 793)
* unset: Bourne Shell Builtins. * unset: Bourne Shell Builtins.
(line 478) (line 482)
* wait: Job Control Builtins. * wait: Job Control Builtins.
(line 76) (line 76)
@@ -12611,13 +12620,13 @@ D.4 Function Index
(line 6) (line 6)
* alias-expand-line (): Miscellaneous Commands. * alias-expand-line (): Miscellaneous Commands.
(line 133) (line 133)
* backward-char (C-b): Commands For Moving. (line 15) * backward-char (C-b): Commands For Moving. (line 17)
* backward-delete-char (Rubout): Commands For Text. (line 17) * backward-delete-char (Rubout): Commands For Text. (line 17)
* backward-kill-line (C-x Rubout): Commands For Killing. * backward-kill-line (C-x Rubout): Commands For Killing.
(line 11) (line 11)
* backward-kill-word (M-<DEL>): Commands For Killing. * backward-kill-word (M-<DEL>): Commands For Killing.
(line 28) (line 28)
* backward-word (M-b): Commands For Moving. (line 22) * backward-word (M-b): Commands For Moving. (line 24)
* beginning-of-history (M-<): Commands For History. * beginning-of-history (M-<): Commands For History.
(line 20) (line 20)
* beginning-of-line (C-a): Commands For Moving. (line 6) * beginning-of-line (C-a): Commands For Moving. (line 6)
@@ -12628,8 +12637,8 @@ D.4 Function Index
(line 42) (line 42)
* character-search-backward (M-C-]): Miscellaneous Commands. * character-search-backward (M-C-]): Miscellaneous Commands.
(line 47) (line 47)
* clear-display (M-C-l): Commands For Moving. (line 48) * clear-display (M-C-l): Commands For Moving. (line 50)
* clear-screen (C-l): Commands For Moving. (line 53) * clear-screen (C-l): Commands For Moving. (line 55)
* complete (<TAB>): Commands For Completion. * complete (<TAB>): Commands For Completion.
(line 6) (line 6)
* complete-command (M-!): Commands For Completion. * complete-command (M-!): Commands For Completion.
@@ -12677,18 +12686,18 @@ D.4 Function Index
* end-of-file (usually C-d): Commands For Text. (line 6) * end-of-file (usually C-d): Commands For Text. (line 6)
* end-of-history (M->): Commands For History. * end-of-history (M->): Commands For History.
(line 23) (line 23)
* end-of-line (C-e): Commands For Moving. (line 9) * end-of-line (C-e): Commands For Moving. (line 10)
* exchange-point-and-mark (C-x C-x): Miscellaneous Commands. * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
(line 37) (line 37)
* execute-named-command (M-x): Miscellaneous Commands. * execute-named-command (M-x): Miscellaneous Commands.
(line 147) (line 147)
* fetch-history (): Commands For History. * fetch-history (): Commands For History.
(line 103) (line 105)
* forward-backward-delete-char (): Commands For Text. (line 21) * forward-backward-delete-char (): Commands For Text. (line 21)
* forward-char (C-f): Commands For Moving. (line 12) * forward-char (C-f): Commands For Moving. (line 14)
* forward-search-history (C-s): Commands For History. * forward-search-history (C-s): Commands For History.
(line 33) (line 33)
* forward-word (M-f): Commands For Moving. (line 18) * forward-word (M-f): Commands For Moving. (line 20)
* glob-complete-word (M-g): Miscellaneous Commands. * glob-complete-word (M-g): Miscellaneous Commands.
(line 98) (line 98)
* glob-expand-word (C-x *): Miscellaneous Commands. * glob-expand-word (C-x *): Miscellaneous Commands.
@@ -12700,13 +12709,13 @@ D.4 Function Index
* history-expand-line (M-^): Miscellaneous Commands. * history-expand-line (M-^): Miscellaneous Commands.
(line 126) (line 126)
* history-search-backward (): Commands For History. * history-search-backward (): Commands For History.
(line 57)
* history-search-forward (): Commands For History.
(line 51) (line 51)
* history-search-forward (): Commands For History.
(line 58)
* history-substring-search-backward (): Commands For History. * history-substring-search-backward (): Commands For History.
(line 69) (line 65)
* history-substring-search-forward (): Commands For History. * history-substring-search-forward (): Commands For History.
(line 63) (line 71)
* insert-comment (M-#): Miscellaneous Commands. * insert-comment (M-#): Miscellaneous Commands.
(line 61) (line 61)
* insert-completions (M-*): Commands For Completion. * insert-completions (M-*): Commands For Completion.
@@ -12729,13 +12738,13 @@ D.4 Function Index
(line 38) (line 38)
* next-history (C-n): Commands For History. * next-history (C-n): Commands For History.
(line 17) (line 17)
* next-screen-line (): Commands For Moving. (line 41) * next-screen-line (): Commands For Moving. (line 43)
* non-incremental-forward-search-history (M-n): Commands For History. * non-incremental-forward-search-history (M-n): Commands For History.
(line 45) (line 45)
* non-incremental-reverse-search-history (M-p): Commands For History. * non-incremental-reverse-search-history (M-p): Commands For History.
(line 39) (line 39)
* operate-and-get-next (C-o): Commands For History. * operate-and-get-next (C-o): Commands For History.
(line 96) (line 98)
* overwrite-mode (): Commands For Text. (line 77) * overwrite-mode (): Commands For Text. (line 77)
* possible-command-completions (C-x !): Commands For Completion. * possible-command-completions (C-x !): Commands For Completion.
(line 86) (line 86)
@@ -12753,12 +12762,12 @@ D.4 Function Index
(line 19) (line 19)
* previous-history (C-p): Commands For History. * previous-history (C-p): Commands For History.
(line 13) (line 13)
* previous-screen-line (): Commands For Moving. (line 34) * previous-screen-line (): Commands For Moving. (line 36)
* print-last-kbd-macro (): Keyboard Macros. (line 17) * print-last-kbd-macro (): Keyboard Macros. (line 17)
* quoted-insert (C-q or C-v): Commands For Text. (line 26) * quoted-insert (C-q or C-v): Commands For Text. (line 26)
* re-read-init-file (C-x C-r): Miscellaneous Commands. * re-read-init-file (C-x C-r): Miscellaneous Commands.
(line 6) (line 6)
* redraw-current-line (): Commands For Moving. (line 57) * redraw-current-line (): Commands For Moving. (line 59)
* reverse-search-history (C-r): Commands For History. * reverse-search-history (C-r): Commands For History.
(line 27) (line 27)
* revert-line (M-r): Miscellaneous Commands. * revert-line (M-r): Miscellaneous Commands.
@@ -12768,10 +12777,10 @@ D.4 Function Index
(line 33) (line 33)
* shell-backward-kill-word (): Commands For Killing. * shell-backward-kill-word (): Commands For Killing.
(line 37) (line 37)
* shell-backward-word (M-C-b): Commands For Moving. (line 30) * shell-backward-word (M-C-b): Commands For Moving. (line 32)
* shell-expand-line (M-C-e): Miscellaneous Commands. * shell-expand-line (M-C-e): Miscellaneous Commands.
(line 119) (line 119)
* shell-forward-word (M-C-f): Commands For Moving. (line 26) * shell-forward-word (M-C-f): Commands For Moving. (line 28)
* shell-kill-word (M-C-d): Commands For Killing. * shell-kill-word (M-C-d): Commands For Killing.
(line 32) (line 32)
* shell-transpose-words (M-C-t): Commands For Text. (line 58) * shell-transpose-words (M-C-t): Commands For Text. (line 58)
@@ -12797,9 +12806,9 @@ D.4 Function Index
* yank (C-y): Commands For Killing. * yank (C-y): Commands For Killing.
(line 72) (line 72)
* yank-last-arg (M-. or M-_): Commands For History. * yank-last-arg (M-. or M-_): Commands For History.
(line 84) (line 86)
* yank-nth-arg (M-C-y): Commands For History. * yank-nth-arg (M-C-y): Commands For History.
(line 75) (line 77)
* yank-pop (M-y): Commands For Killing. * yank-pop (M-y): Commands For Killing.
(line 75) (line 75)
@@ -12980,138 +12989,138 @@ D.5 Concept Index
 
Tag Table: Tag Table:
Node: Top895 Node: Top893
Node: Introduction2830 Node: Introduction2826
Node: What is Bash?3043 Node: What is Bash?3039
Node: What is a shell?4184 Node: What is a shell?4180
Node: Definitions6763 Node: Definitions6759
Node: Basic Shell Features9939 Node: Basic Shell Features9935
Node: Shell Syntax11159 Node: Shell Syntax11155
Node: Shell Operation12186 Node: Shell Operation12182
Node: Quoting13484 Node: Quoting13480
Node: Escape Character14797 Node: Escape Character14793
Node: Single Quotes15295 Node: Single Quotes15291
Node: Double Quotes15644 Node: Double Quotes15640
Node: ANSI-C Quoting16987 Node: ANSI-C Quoting16983
Node: Locale Translation18372 Node: Locale Translation18368
Node: Creating Internationalized Scripts19716 Node: Creating Internationalized Scripts19712
Node: Comments23914 Node: Comments23910
Node: Shell Commands24549 Node: Shell Commands24545
Node: Reserved Words25488 Node: Reserved Words25484
Node: Simple Commands26353 Node: Simple Commands26349
Node: Pipelines27012 Node: Pipelines27008
Node: Lists30075 Node: Lists30071
Node: Compound Commands31947 Node: Compound Commands31943
Node: Looping Constructs32956 Node: Looping Constructs32952
Node: Conditional Constructs35500 Node: Conditional Constructs35496
Node: Command Grouping50404 Node: Command Grouping50317
Node: Coprocesses51891 Node: Coprocesses51804
Node: GNU Parallel54587 Node: GNU Parallel54500
Node: Shell Functions55505 Node: Shell Functions55418
Node: Shell Parameters63611 Node: Shell Parameters63524
Node: Positional Parameters68144 Node: Positional Parameters68057
Node: Special Parameters69079 Node: Special Parameters68992
Node: Shell Expansions72385 Node: Shell Expansions72298
Node: Brace Expansion74574 Node: Brace Expansion74487
Node: Tilde Expansion77237 Node: Tilde Expansion77150
Node: Shell Parameter Expansion80003 Node: Shell Parameter Expansion79916
Node: Command Substitution99110 Node: Command Substitution99023
Node: Arithmetic Expansion102643 Node: Arithmetic Expansion102556
Node: Process Substitution103608 Node: Process Substitution103521
Node: Word Splitting104745 Node: Word Splitting104658
Node: Filename Expansion106886 Node: Filename Expansion106799
Node: Pattern Matching109982 Node: Pattern Matching109895
Node: Quote Removal115215 Node: Quote Removal115128
Node: Redirections115519 Node: Redirections115432
Node: Executing Commands125328 Node: Executing Commands125241
Node: Simple Command Expansion125995 Node: Simple Command Expansion125908
Node: Command Search and Execution128106 Node: Command Search and Execution128019
Node: Command Execution Environment130514 Node: Command Execution Environment130427
Node: Environment133823 Node: Environment133736
Node: Exit Status135527 Node: Exit Status135440
Node: Signals137312 Node: Signals137225
Node: Shell Scripts140926 Node: Shell Scripts140839
Node: Shell Builtin Commands144018 Node: Shell Builtin Commands143931
Node: Bourne Shell Builtins146129 Node: Bourne Shell Builtins146042
Node: Bash Builtins170533 Node: Bash Builtins170812
Node: Modifying Shell Behavior205492 Node: Modifying Shell Behavior205793
Node: The Set Builtin205834 Node: The Set Builtin206135
Node: The Shopt Builtin217349 Node: The Shopt Builtin217650
Node: Special Builtins234085 Node: Special Builtins234437
Node: Shell Variables235074 Node: Shell Variables235426
Node: Bourne Shell Variables235508 Node: Bourne Shell Variables235860
Node: Bash Variables237701 Node: Bash Variables238053
Node: Bash Features274283 Node: Bash Features274670
Node: Invoking Bash275297 Node: Invoking Bash275684
Node: Bash Startup Files281696 Node: Bash Startup Files282083
Node: Interactive Shells287008 Node: Interactive Shells287395
Node: What is an Interactive Shell?287416 Node: What is an Interactive Shell?287803
Node: Is this Shell Interactive?288082 Node: Is this Shell Interactive?288469
Node: Interactive Shell Behavior288906 Node: Interactive Shell Behavior289293
Node: Bash Conditional Expressions292660 Node: Bash Conditional Expressions293047
Node: Shell Arithmetic297834 Node: Shell Arithmetic298221
Node: Aliases300916 Node: Aliases301303
Node: Arrays303871 Node: Arrays304258
Node: The Directory Stack310670 Node: The Directory Stack311057
Node: Directory Stack Builtins311467 Node: Directory Stack Builtins311854
Node: Controlling the Prompt315916 Node: Controlling the Prompt316303
Node: The Restricted Shell319054 Node: The Restricted Shell319441
Node: Bash POSIX Mode321841 Node: Bash POSIX Mode322228
Node: Shell Compatibility Mode339352 Node: Shell Compatibility Mode339739
Node: Job Control348371 Node: Job Control348758
Node: Job Control Basics348828 Node: Job Control Basics349215
Node: Job Control Builtins354002 Node: Job Control Builtins354389
Node: Job Control Variables359962 Node: Job Control Variables360349
Node: Command Line Editing361139 Node: Command Line Editing361526
Node: Introduction and Notation362843 Node: Introduction and Notation363230
Node: Readline Interaction364487 Node: Readline Interaction364874
Node: Readline Bare Essentials365675 Node: Readline Bare Essentials366062
Node: Readline Movement Commands367493 Node: Readline Movement Commands367880
Node: Readline Killing Commands368490 Node: Readline Killing Commands368877
Node: Readline Arguments370468 Node: Readline Arguments370855
Node: Searching371525 Node: Searching371912
Node: Readline Init File373754 Node: Readline Init File374141
Node: Readline Init File Syntax375036 Node: Readline Init File Syntax375423
Node: Conditional Init Constructs399974 Node: Conditional Init Constructs400361
Node: Sample Init File404339 Node: Sample Init File404726
Node: Bindable Readline Commands407460 Node: Bindable Readline Commands407847
Node: Commands For Moving408685 Node: Commands For Moving409072
Node: Commands For History410785 Node: Commands For History411299
Node: Commands For Text415868 Node: Commands For Text416504
Node: Commands For Killing419943 Node: Commands For Killing420638
Node: Numeric Arguments422744 Node: Numeric Arguments423439
Node: Commands For Completion423896 Node: Commands For Completion424591
Node: Keyboard Macros428212 Node: Keyboard Macros428907
Node: Miscellaneous Commands428913 Node: Miscellaneous Commands429608
Node: Readline vi Mode435567 Node: Readline vi Mode436262
Node: Programmable Completion436519 Node: Programmable Completion437214
Node: Programmable Completion Builtins444476 Node: Programmable Completion Builtins445171
Node: A Programmable Completion Example456042 Node: A Programmable Completion Example456737
Node: Using History Interactively461387 Node: Using History Interactively462082
Node: Bash History Facilities462068 Node: Bash History Facilities462763
Node: Bash History Builtins465180 Node: Bash History Builtins465875
Node: History Interaction470423 Node: History Interaction471118
Node: Event Designators474748 Node: Event Designators475443
Node: Word Designators476331 Node: Word Designators477026
Node: Modifiers478317 Node: Modifiers479012
Node: Installing Bash480226 Node: Installing Bash480921
Node: Basic Installation481360 Node: Basic Installation482055
Node: Compilers and Options485239 Node: Compilers and Options485934
Node: Compiling For Multiple Architectures485989 Node: Compiling For Multiple Architectures486684
Node: Installation Names487738 Node: Installation Names488433
Node: Specifying the System Type489972 Node: Specifying the System Type490667
Node: Sharing Defaults490718 Node: Sharing Defaults491413
Node: Operation Controls491432 Node: Operation Controls492127
Node: Optional Features492451 Node: Optional Features493146
Node: Reporting Bugs504253 Node: Reporting Bugs504948
Node: Major Differences From The Bourne Shell505602 Node: Major Differences From The Bourne Shell506297
Node: GNU Free Documentation License525337 Node: GNU Free Documentation License526032
Node: Indexes550514 Node: Indexes551209
Node: Builtin Index550965 Node: Builtin Index551660
Node: Reserved Word Index558063 Node: Reserved Word Index558758
Node: Variable Index560508 Node: Variable Index561203
Node: Function Index577639 Node: Function Index578334
Node: Concept Index591495 Node: Concept Index592190
 
End Tag Table End Tag Table
BIN
View File
Binary file not shown.
+222 -213
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 7.1 from
bashref.texi. bashref.texi.
This text is a brief description of the features that are present in the This text is a brief description of the features that are present in the
Bash shell (version 5.3, 23 April 2024). Bash shell (version 5.3, 12 June 2024).
This is Edition 5.3, last updated 23 April 2024, of The GNU Bash This is Edition 5.3, last updated 12 June 2024, of The GNU Bash
Reference Manual, for Bash, Version 5.3. Reference Manual, for Bash, Version 5.3.
Copyright © 1988-2023 Free Software Foundation, Inc. Copyright © 1988-2023 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
************* *************
This text is a brief description of the features that are present in the This text is a brief description of the features that are present in the
Bash shell (version 5.3, 23 April 2024). The Bash home page is Bash shell (version 5.3, 12 June 2024). The Bash home page is
<http://www.gnu.org/software/bash/>. <http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 23 April 2024, of The GNU Bash This is Edition 5.3, last updated 12 June 2024, of The GNU Bash
Reference Manual, for Bash, Version 5.3. Reference Manual, for Bash, Version 5.3.
Bash contains features that appear in other popular shells, and some Bash contains features that appear in other popular shells, and some
@@ -992,9 +992,8 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
and filename expansion. The shell performs tilde expansion, and filename expansion. The shell performs tilde expansion,
parameter and variable expansion, arithmetic expansion, command parameter and variable expansion, arithmetic expansion, command
substitution, process substitution, and quote removal on those substitution, process substitution, and quote removal on those
words (the expansions that would occur if the words were enclosed words. Conditional operators such as -f must be unquoted to be
in double quotes). Conditional operators such as -f must be recognized as primaries.
unquoted to be recognized as primaries.
When used with [[, the < and > operators sort When used with [[, the < and > operators sort
lexicographically using the current locale. lexicographically using the current locale.
@@ -3281,24 +3280,28 @@ standard.
The return status is zero. The return status is zero.
. (a period) . (a period)
. FILENAME [ARGUMENTS] . [-p PATH] FILENAME [ARGUMENTS]
Read and execute commands from the FILENAME argument in the current Read and execute commands from the FILENAME argument in the current
shell context. If FILENAME does not contain a slash, the PATH shell context. If FILENAME does not contain a slash, . searches
variable is used to find FILENAME, but FILENAME does not need to be for it. If -p is supplied, . treats PATH as a colon-separated
executable. When Bash is not in POSIX mode, it searches the list of directories in which to find FILENAME; otherwise, . uses
current directory if FILENAME is not found in $PATH. If any the directories in PATH to find FILENAME. FILENAME does not need
ARGUMENTS are supplied, they become the positional parameters when to be executable. When Bash is not in POSIX mode, it searches the
FILENAME is executed. Otherwise the positional parameters are current directory if FILENAME is not found in $PATH, but does not
unchanged. If the -T option is enabled, . inherits any trap on search the current directory if -p is supplied. If the
DEBUG; if it is not, any DEBUG trap string is saved and sourcepath option (*note The Shopt Builtin::) is turned off .
restored around the call to ., and . unsets the DEBUG trap does not search PATH. If any ARGUMENTS are supplied, they become
while it executes. If -T is not set, and the sourced file the positional parameters when FILENAME is executed. Otherwise the
changes the DEBUG trap, the new value is retained when . positional parameters are unchanged. If the -T option is
completes. The return status is the exit status of the last enabled, . inherits any trap on DEBUG; if it is not, any
command executed, or zero if no commands are executed. If FILENAME DEBUG trap string is saved and restored around the call to .,
is not found, or cannot be read, the return status is non-zero. and . unsets the DEBUG trap while it executes. If -T is not
This builtin is equivalent to source. set, and the sourced file changes the DEBUG trap, the new value
is retained when . completes. The return status is the exit
status of the last command executed, or zero if no commands are
executed. If FILENAME is not found, or cannot be read, the return
status is non-zero. This builtin is equivalent to source.
break break
break [N] break [N]
@@ -4397,7 +4400,7 @@ standard.
A synonym for mapfile. A synonym for mapfile.
source source
source FILENAME source [-p PATH] FILENAME [ARGUMENTS]
A synonym for . (*note Bourne Shell Builtins::). A synonym for . (*note Bourne Shell Builtins::).
@@ -5224,8 +5227,9 @@ This builtin allows you to change additional shell optional behavior.
sourcepath sourcepath
If set, the . (source) builtin uses the value of PATH to If set, the . (source) builtin uses the value of PATH to
find the directory containing the file supplied as an find the directory containing the file supplied as an argument
argument. This option is enabled by default. when the -p option is not supplied. This option is enabled
by default.
varredir_close varredir_close
If set, the shell automatically closes file descriptors If set, the shell automatically closes file descriptors
@@ -5730,7 +5734,7 @@ Variables::).
A sort specifier of nosort disables sorting completely; the A sort specifier of nosort disables sorting completely; the
results are returned in the order they are read from the file results are returned in the order they are read from the file
system,. system, and any leading - is ignored.
If the sort specifier is missing, it defaults to NAME, so a value If the sort specifier is missing, it defaults to NAME, so a value
of + is equivalent to the null string, and a value of - sorts of + is equivalent to the null string, and a value of - sorts
@@ -9097,10 +9101,12 @@ File: bashref.info, Node: Commands For Moving, Next: Commands For History, Up
------------------------- -------------------------
beginning-of-line (C-a) beginning-of-line (C-a)
Move to the start of the current line. Move to the start of the current line. This may also be bound to
the Home key on some keyboards.
end-of-line (C-e) end-of-line (C-e)
Move to the end of the line. Move to the end of the line. This may also be bound to the End key
on some keyboards.
forward-char (C-f) forward-char (C-f)
Move forward a character. Move forward a character.
@@ -9201,26 +9207,28 @@ File: bashref.info, Node: Commands For History, Next: Commands For Text, Prev
a string supplied by the user. The search string may match a string supplied by the user. The search string may match
anywhere in a history line. anywhere in a history line.
history-search-forward ()
Search forward through the history for the string of characters
between the start of the current line and the point. The search
string must match at the beginning of a history line. This is a
non-incremental search. By default, this command is unbound.
history-search-backward () history-search-backward ()
Search backward through the history for the string of characters Search backward through the history for the string of characters
between the start of the current line and the point. The search between the start of the current line and the point. The search
string must match at the beginning of a history line. This is a string must match at the beginning of a history line. This is a
non-incremental search. By default, this command is unbound. non-incremental search. By default, this command is unbound, but
may be bound to the Page Down key on some keyboards.
history-substring-search-forward () history-search-forward ()
Search forward through the history for the string of characters Search forward through the history for the string of characters
between the start of the current line and the point. The search between the start of the current line and the point. The search
string must match at the beginning of a history line. This is a
non-incremental search. By default, this command is unbound, but
may be bound to the Page Up key on some keyboards.
history-substring-search-backward ()
Search backward through the history for the string of characters
between the start of the current line and the point. The search
string may match anywhere in a history line. This is a string may match anywhere in a history line. This is a
non-incremental search. By default, this command is unbound. non-incremental search. By default, this command is unbound.
history-substring-search-backward () history-substring-search-forward ()
Search backward through the history for the string of characters Search forward through the history for the string of characters
between the start of the current line and the point. The search between the start of the current line and the point. The search
string may match anywhere in a history line. This is a string may match anywhere in a history line. This is a
non-incremental search. By default, this command is unbound. non-incremental search. By default, this command is unbound.
@@ -9347,7 +9355,8 @@ File: bashref.info, Node: Commands For Text, Next: Commands For Killing, Prev
Characters bound to backward-delete-char replace the character Characters bound to backward-delete-char replace the character
before point with a space. before point with a space.
By default, this command is unbound. By default, this command is unbound, but may be bound to the Insert
key on some keyboards.
 
File: bashref.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands File: bashref.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
@@ -12214,17 +12223,17 @@ D.1 Index of Shell Builtin Commands
* .: Bourne Shell Builtins. * .: Bourne Shell Builtins.
(line 17) (line 17)
* [: Bourne Shell Builtins. * [: Bourne Shell Builtins.
(line 285) (line 289)
* alias: Bash Builtins. (line 11) * alias: Bash Builtins. (line 11)
* bg: Job Control Builtins. * bg: Job Control Builtins.
(line 7) (line 7)
* bind: Bash Builtins. (line 21) * bind: Bash Builtins. (line 21)
* break: Bourne Shell Builtins. * break: Bourne Shell Builtins.
(line 37) (line 41)
* builtin: Bash Builtins. (line 124) * builtin: Bash Builtins. (line 124)
* caller: Bash Builtins. (line 133) * caller: Bash Builtins. (line 133)
* cd: Bourne Shell Builtins. * cd: Bourne Shell Builtins.
(line 45) (line 49)
* command: Bash Builtins. (line 150) * command: Bash Builtins. (line 150)
* compgen: Programmable Completion Builtins. * compgen: Programmable Completion Builtins.
(line 12) (line 12)
@@ -12233,7 +12242,7 @@ D.1 Index of Shell Builtin Commands
* compopt: Programmable Completion Builtins. * compopt: Programmable Completion Builtins.
(line 248) (line 248)
* continue: Bourne Shell Builtins. * continue: Bourne Shell Builtins.
(line 90) (line 94)
* declare: Bash Builtins. (line 170) * declare: Bash Builtins. (line 170)
* dirs: Directory Stack Builtins. * dirs: Directory Stack Builtins.
(line 7) (line 7)
@@ -12242,23 +12251,23 @@ D.1 Index of Shell Builtin Commands
* echo: Bash Builtins. (line 273) * echo: Bash Builtins. (line 273)
* enable: Bash Builtins. (line 322) * enable: Bash Builtins. (line 322)
* eval: Bourne Shell Builtins. * eval: Bourne Shell Builtins.
(line 99) (line 103)
* exec: Bourne Shell Builtins. * exec: Bourne Shell Builtins.
(line 107) (line 111)
* exit: Bourne Shell Builtins. * exit: Bourne Shell Builtins.
(line 125) (line 129)
* export: Bourne Shell Builtins. * export: Bourne Shell Builtins.
(line 132) (line 136)
* false: Bourne Shell Builtins. * false: Bourne Shell Builtins.
(line 148) (line 152)
* fc: Bash History Builtins. * fc: Bash History Builtins.
(line 10) (line 10)
* fg: Job Control Builtins. * fg: Job Control Builtins.
(line 17) (line 17)
* getopts: Bourne Shell Builtins. * getopts: Bourne Shell Builtins.
(line 153) (line 157)
* hash: Bourne Shell Builtins. * hash: Bourne Shell Builtins.
(line 197) (line 201)
* help: Bash Builtins. (line 360) * help: Bash Builtins. (line 360)
* history: Bash History Builtins. * history: Bash History Builtins.
(line 46) (line 46)
@@ -12276,36 +12285,36 @@ D.1 Index of Shell Builtin Commands
* pushd: Directory Stack Builtins. * pushd: Directory Stack Builtins.
(line 69) (line 69)
* pwd: Bourne Shell Builtins. * pwd: Bourne Shell Builtins.
(line 222) (line 226)
* read: Bash Builtins. (line 523) * read: Bash Builtins. (line 523)
* readarray: Bash Builtins. (line 629) * readarray: Bash Builtins. (line 629)
* readonly: Bourne Shell Builtins. * readonly: Bourne Shell Builtins.
(line 232) (line 236)
* return: Bourne Shell Builtins. * return: Bourne Shell Builtins.
(line 251) (line 255)
* set: The Set Builtin. (line 11) * set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins. * shift: Bourne Shell Builtins.
(line 272) (line 276)
* shopt: The Shopt Builtin. (line 9) * shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 638) * source: Bash Builtins. (line 638)
* suspend: Job Control Builtins. * suspend: Job Control Builtins.
(line 116) (line 116)
* test: Bourne Shell Builtins. * test: Bourne Shell Builtins.
(line 285) (line 289)
* times: Bourne Shell Builtins. * times: Bourne Shell Builtins.
(line 387) (line 391)
* trap: Bourne Shell Builtins. * trap: Bourne Shell Builtins.
(line 393) (line 397)
* true: Bourne Shell Builtins. * true: Bourne Shell Builtins.
(line 455) (line 459)
* type: Bash Builtins. (line 643) * type: Bash Builtins. (line 643)
* typeset: Bash Builtins. (line 681) * typeset: Bash Builtins. (line 681)
* ulimit: Bash Builtins. (line 687) * ulimit: Bash Builtins. (line 687)
* umask: Bourne Shell Builtins. * umask: Bourne Shell Builtins.
(line 460) (line 464)
* unalias: Bash Builtins. (line 793) * unalias: Bash Builtins. (line 793)
* unset: Bourne Shell Builtins. * unset: Bourne Shell Builtins.
(line 478) (line 482)
* wait: Job Control Builtins. * wait: Job Control Builtins.
(line 76) (line 76)
@@ -12612,13 +12621,13 @@ D.4 Function Index
(line 6) (line 6)
* alias-expand-line (): Miscellaneous Commands. * alias-expand-line (): Miscellaneous Commands.
(line 133) (line 133)
* backward-char (C-b): Commands For Moving. (line 15) * backward-char (C-b): Commands For Moving. (line 17)
* backward-delete-char (Rubout): Commands For Text. (line 17) * backward-delete-char (Rubout): Commands For Text. (line 17)
* backward-kill-line (C-x Rubout): Commands For Killing. * backward-kill-line (C-x Rubout): Commands For Killing.
(line 11) (line 11)
* backward-kill-word (M-<DEL>): Commands For Killing. * backward-kill-word (M-<DEL>): Commands For Killing.
(line 28) (line 28)
* backward-word (M-b): Commands For Moving. (line 22) * backward-word (M-b): Commands For Moving. (line 24)
* beginning-of-history (M-<): Commands For History. * beginning-of-history (M-<): Commands For History.
(line 20) (line 20)
* beginning-of-line (C-a): Commands For Moving. (line 6) * beginning-of-line (C-a): Commands For Moving. (line 6)
@@ -12629,8 +12638,8 @@ D.4 Function Index
(line 42) (line 42)
* character-search-backward (M-C-]): Miscellaneous Commands. * character-search-backward (M-C-]): Miscellaneous Commands.
(line 47) (line 47)
* clear-display (M-C-l): Commands For Moving. (line 48) * clear-display (M-C-l): Commands For Moving. (line 50)
* clear-screen (C-l): Commands For Moving. (line 53) * clear-screen (C-l): Commands For Moving. (line 55)
* complete (<TAB>): Commands For Completion. * complete (<TAB>): Commands For Completion.
(line 6) (line 6)
* complete-command (M-!): Commands For Completion. * complete-command (M-!): Commands For Completion.
@@ -12678,18 +12687,18 @@ D.4 Function Index
* end-of-file (usually C-d): Commands For Text. (line 6) * end-of-file (usually C-d): Commands For Text. (line 6)
* end-of-history (M->): Commands For History. * end-of-history (M->): Commands For History.
(line 23) (line 23)
* end-of-line (C-e): Commands For Moving. (line 9) * end-of-line (C-e): Commands For Moving. (line 10)
* exchange-point-and-mark (C-x C-x): Miscellaneous Commands. * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
(line 37) (line 37)
* execute-named-command (M-x): Miscellaneous Commands. * execute-named-command (M-x): Miscellaneous Commands.
(line 147) (line 147)
* fetch-history (): Commands For History. * fetch-history (): Commands For History.
(line 103) (line 105)
* forward-backward-delete-char (): Commands For Text. (line 21) * forward-backward-delete-char (): Commands For Text. (line 21)
* forward-char (C-f): Commands For Moving. (line 12) * forward-char (C-f): Commands For Moving. (line 14)
* forward-search-history (C-s): Commands For History. * forward-search-history (C-s): Commands For History.
(line 33) (line 33)
* forward-word (M-f): Commands For Moving. (line 18) * forward-word (M-f): Commands For Moving. (line 20)
* glob-complete-word (M-g): Miscellaneous Commands. * glob-complete-word (M-g): Miscellaneous Commands.
(line 98) (line 98)
* glob-expand-word (C-x *): Miscellaneous Commands. * glob-expand-word (C-x *): Miscellaneous Commands.
@@ -12701,13 +12710,13 @@ D.4 Function Index
* history-expand-line (M-^): Miscellaneous Commands. * history-expand-line (M-^): Miscellaneous Commands.
(line 126) (line 126)
* history-search-backward (): Commands For History. * history-search-backward (): Commands For History.
(line 57)
* history-search-forward (): Commands For History.
(line 51) (line 51)
* history-search-forward (): Commands For History.
(line 58)
* history-substring-search-backward (): Commands For History. * history-substring-search-backward (): Commands For History.
(line 69) (line 65)
* history-substring-search-forward (): Commands For History. * history-substring-search-forward (): Commands For History.
(line 63) (line 71)
* insert-comment (M-#): Miscellaneous Commands. * insert-comment (M-#): Miscellaneous Commands.
(line 61) (line 61)
* insert-completions (M-*): Commands For Completion. * insert-completions (M-*): Commands For Completion.
@@ -12730,13 +12739,13 @@ D.4 Function Index
(line 38) (line 38)
* next-history (C-n): Commands For History. * next-history (C-n): Commands For History.
(line 17) (line 17)
* next-screen-line (): Commands For Moving. (line 41) * next-screen-line (): Commands For Moving. (line 43)
* non-incremental-forward-search-history (M-n): Commands For History. * non-incremental-forward-search-history (M-n): Commands For History.
(line 45) (line 45)
* non-incremental-reverse-search-history (M-p): Commands For History. * non-incremental-reverse-search-history (M-p): Commands For History.
(line 39) (line 39)
* operate-and-get-next (C-o): Commands For History. * operate-and-get-next (C-o): Commands For History.
(line 96) (line 98)
* overwrite-mode (): Commands For Text. (line 77) * overwrite-mode (): Commands For Text. (line 77)
* possible-command-completions (C-x !): Commands For Completion. * possible-command-completions (C-x !): Commands For Completion.
(line 86) (line 86)
@@ -12754,12 +12763,12 @@ D.4 Function Index
(line 19) (line 19)
* previous-history (C-p): Commands For History. * previous-history (C-p): Commands For History.
(line 13) (line 13)
* previous-screen-line (): Commands For Moving. (line 34) * previous-screen-line (): Commands For Moving. (line 36)
* print-last-kbd-macro (): Keyboard Macros. (line 17) * print-last-kbd-macro (): Keyboard Macros. (line 17)
* quoted-insert (C-q or C-v): Commands For Text. (line 26) * quoted-insert (C-q or C-v): Commands For Text. (line 26)
* re-read-init-file (C-x C-r): Miscellaneous Commands. * re-read-init-file (C-x C-r): Miscellaneous Commands.
(line 6) (line 6)
* redraw-current-line (): Commands For Moving. (line 57) * redraw-current-line (): Commands For Moving. (line 59)
* reverse-search-history (C-r): Commands For History. * reverse-search-history (C-r): Commands For History.
(line 27) (line 27)
* revert-line (M-r): Miscellaneous Commands. * revert-line (M-r): Miscellaneous Commands.
@@ -12769,10 +12778,10 @@ D.4 Function Index
(line 33) (line 33)
* shell-backward-kill-word (): Commands For Killing. * shell-backward-kill-word (): Commands For Killing.
(line 37) (line 37)
* shell-backward-word (M-C-b): Commands For Moving. (line 30) * shell-backward-word (M-C-b): Commands For Moving. (line 32)
* shell-expand-line (M-C-e): Miscellaneous Commands. * shell-expand-line (M-C-e): Miscellaneous Commands.
(line 119) (line 119)
* shell-forward-word (M-C-f): Commands For Moving. (line 26) * shell-forward-word (M-C-f): Commands For Moving. (line 28)
* shell-kill-word (M-C-d): Commands For Killing. * shell-kill-word (M-C-d): Commands For Killing.
(line 32) (line 32)
* shell-transpose-words (M-C-t): Commands For Text. (line 58) * shell-transpose-words (M-C-t): Commands For Text. (line 58)
@@ -12798,9 +12807,9 @@ D.4 Function Index
* yank (C-y): Commands For Killing. * yank (C-y): Commands For Killing.
(line 72) (line 72)
* yank-last-arg (M-. or M-_): Commands For History. * yank-last-arg (M-. or M-_): Commands For History.
(line 84) (line 86)
* yank-nth-arg (M-C-y): Commands For History. * yank-nth-arg (M-C-y): Commands For History.
(line 75) (line 77)
* yank-pop (M-y): Commands For Killing. * yank-pop (M-y): Commands For Killing.
(line 75) (line 75)
@@ -12981,138 +12990,138 @@ D.5 Concept Index
 
Tag Table: Tag Table:
Node: Top898 Node: Top896
Node: Introduction2836 Node: Introduction2832
Node: What is Bash?3052 Node: What is Bash?3048
Node: What is a shell?4196 Node: What is a shell?4192
Node: Definitions6778 Node: Definitions6774
Node: Basic Shell Features9957 Node: Basic Shell Features9953
Node: Shell Syntax11180 Node: Shell Syntax11176
Node: Shell Operation12210 Node: Shell Operation12206
Node: Quoting13511 Node: Quoting13507
Node: Escape Character14827 Node: Escape Character14823
Node: Single Quotes15328 Node: Single Quotes15324
Node: Double Quotes15680 Node: Double Quotes15676
Node: ANSI-C Quoting17026 Node: ANSI-C Quoting17022
Node: Locale Translation18414 Node: Locale Translation18410
Node: Creating Internationalized Scripts19761 Node: Creating Internationalized Scripts19757
Node: Comments23962 Node: Comments23958
Node: Shell Commands24600 Node: Shell Commands24596
Node: Reserved Words25542 Node: Reserved Words25538
Node: Simple Commands26410 Node: Simple Commands26406
Node: Pipelines27072 Node: Pipelines27068
Node: Lists30138 Node: Lists30134
Node: Compound Commands32013 Node: Compound Commands32009
Node: Looping Constructs33025 Node: Looping Constructs33021
Node: Conditional Constructs35572 Node: Conditional Constructs35568
Node: Command Grouping50479 Node: Command Grouping50392
Node: Coprocesses51969 Node: Coprocesses51882
Node: GNU Parallel54668 Node: GNU Parallel54581
Node: Shell Functions55589 Node: Shell Functions55502
Node: Shell Parameters63698 Node: Shell Parameters63611
Node: Positional Parameters68234 Node: Positional Parameters68147
Node: Special Parameters69172 Node: Special Parameters69085
Node: Shell Expansions72481 Node: Shell Expansions72394
Node: Brace Expansion74673 Node: Brace Expansion74586
Node: Tilde Expansion77339 Node: Tilde Expansion77252
Node: Shell Parameter Expansion80108 Node: Shell Parameter Expansion80021
Node: Command Substitution99218 Node: Command Substitution99131
Node: Arithmetic Expansion102754 Node: Arithmetic Expansion102667
Node: Process Substitution103722 Node: Process Substitution103635
Node: Word Splitting104862 Node: Word Splitting104775
Node: Filename Expansion107006 Node: Filename Expansion106919
Node: Pattern Matching110105 Node: Pattern Matching110018
Node: Quote Removal115341 Node: Quote Removal115254
Node: Redirections115648 Node: Redirections115561
Node: Executing Commands125460 Node: Executing Commands125373
Node: Simple Command Expansion126130 Node: Simple Command Expansion126043
Node: Command Search and Execution128244 Node: Command Search and Execution128157
Node: Command Execution Environment130655 Node: Command Execution Environment130568
Node: Environment133967 Node: Environment133880
Node: Exit Status135674 Node: Exit Status135587
Node: Signals137462 Node: Signals137375
Node: Shell Scripts141079 Node: Shell Scripts140992
Node: Shell Builtin Commands144174 Node: Shell Builtin Commands144087
Node: Bourne Shell Builtins146288 Node: Bourne Shell Builtins146201
Node: Bash Builtins170695 Node: Bash Builtins170974
Node: Modifying Shell Behavior205657 Node: Modifying Shell Behavior205958
Node: The Set Builtin206002 Node: The Set Builtin206303
Node: The Shopt Builtin217520 Node: The Shopt Builtin217821
Node: Special Builtins234259 Node: Special Builtins234611
Node: Shell Variables235251 Node: Shell Variables235603
Node: Bourne Shell Variables235688 Node: Bourne Shell Variables236040
Node: Bash Variables237884 Node: Bash Variables238236
Node: Bash Features274469 Node: Bash Features274856
Node: Invoking Bash275486 Node: Invoking Bash275873
Node: Bash Startup Files281888 Node: Bash Startup Files282275
Node: Interactive Shells287203 Node: Interactive Shells287590
Node: What is an Interactive Shell?287614 Node: What is an Interactive Shell?288001
Node: Is this Shell Interactive?288283 Node: Is this Shell Interactive?288670
Node: Interactive Shell Behavior289110 Node: Interactive Shell Behavior289497
Node: Bash Conditional Expressions292867 Node: Bash Conditional Expressions293254
Node: Shell Arithmetic298044 Node: Shell Arithmetic298431
Node: Aliases301129 Node: Aliases301516
Node: Arrays304087 Node: Arrays304474
Node: The Directory Stack310889 Node: The Directory Stack311276
Node: Directory Stack Builtins311689 Node: Directory Stack Builtins312076
Node: Controlling the Prompt316141 Node: Controlling the Prompt316528
Node: The Restricted Shell319282 Node: The Restricted Shell319669
Node: Bash POSIX Mode322072 Node: Bash POSIX Mode322459
Node: Shell Compatibility Mode339586 Node: Shell Compatibility Mode339973
Node: Job Control348608 Node: Job Control348995
Node: Job Control Basics349068 Node: Job Control Basics349455
Node: Job Control Builtins354245 Node: Job Control Builtins354632
Node: Job Control Variables360208 Node: Job Control Variables360595
Node: Command Line Editing361388 Node: Command Line Editing361775
Node: Introduction and Notation363095 Node: Introduction and Notation363482
Node: Readline Interaction364742 Node: Readline Interaction365129
Node: Readline Bare Essentials365933 Node: Readline Bare Essentials366320
Node: Readline Movement Commands367754 Node: Readline Movement Commands368141
Node: Readline Killing Commands368754 Node: Readline Killing Commands369141
Node: Readline Arguments370735 Node: Readline Arguments371122
Node: Searching371795 Node: Searching372182
Node: Readline Init File374027 Node: Readline Init File374414
Node: Readline Init File Syntax375312 Node: Readline Init File Syntax375699
Node: Conditional Init Constructs400253 Node: Conditional Init Constructs400640
Node: Sample Init File404621 Node: Sample Init File405008
Node: Bindable Readline Commands407745 Node: Bindable Readline Commands408132
Node: Commands For Moving408973 Node: Commands For Moving409360
Node: Commands For History411076 Node: Commands For History411590
Node: Commands For Text416162 Node: Commands For Text416798
Node: Commands For Killing420240 Node: Commands For Killing420935
Node: Numeric Arguments423044 Node: Numeric Arguments423739
Node: Commands For Completion424199 Node: Commands For Completion424894
Node: Keyboard Macros428518 Node: Keyboard Macros429213
Node: Miscellaneous Commands429222 Node: Miscellaneous Commands429917
Node: Readline vi Mode435879 Node: Readline vi Mode436574
Node: Programmable Completion436834 Node: Programmable Completion437529
Node: Programmable Completion Builtins444794 Node: Programmable Completion Builtins445489
Node: A Programmable Completion Example456363 Node: A Programmable Completion Example457058
Node: Using History Interactively461711 Node: Using History Interactively462406
Node: Bash History Facilities462395 Node: Bash History Facilities463090
Node: Bash History Builtins465510 Node: Bash History Builtins466205
Node: History Interaction470756 Node: History Interaction471451
Node: Event Designators475084 Node: Event Designators475779
Node: Word Designators476670 Node: Word Designators477365
Node: Modifiers478659 Node: Modifiers479354
Node: Installing Bash480571 Node: Installing Bash481266
Node: Basic Installation481708 Node: Basic Installation482403
Node: Compilers and Options485590 Node: Compilers and Options486285
Node: Compiling For Multiple Architectures486343 Node: Compiling For Multiple Architectures487038
Node: Installation Names488095 Node: Installation Names488790
Node: Specifying the System Type490332 Node: Specifying the System Type491027
Node: Sharing Defaults491081 Node: Sharing Defaults491776
Node: Operation Controls491798 Node: Operation Controls492493
Node: Optional Features492820 Node: Optional Features493515
Node: Reporting Bugs504625 Node: Reporting Bugs505320
Node: Major Differences From The Bourne Shell505977 Node: Major Differences From The Bourne Shell506672
Node: GNU Free Documentation License525715 Node: GNU Free Documentation License526410
Node: Indexes550895 Node: Indexes551590
Node: Builtin Index551349 Node: Builtin Index552044
Node: Reserved Word Index558450 Node: Reserved Word Index559145
Node: Variable Index560898 Node: Variable Index561593
Node: Function Index578032 Node: Function Index578727
Node: Concept Index591891 Node: Concept Index592586
 
End Tag Table End Tag Table
+16 -9
View File
@@ -3858,18 +3858,24 @@ The return status is zero.
@item . @r{(a period)} @item . @r{(a period)}
@btindex . @btindex .
@example @example
. @var{filename} [@var{arguments}] . [-p @var{path}] @var{filename} [@var{arguments}]
@end example @end example
Read and execute commands from the @var{filename} argument in the Read and execute commands from the @var{filename} argument in the
current shell context. If @var{filename} does not contain a slash, current shell context.
the @env{PATH} variable is used to find @var{filename}, If @var{filename} does not contain a slash, @code{.} searches for it.
but @var{filename} does not need to be executable. If @option{-p} is supplied, @code{.} treats @var{path}
as a colon-separated list of directories in which to find @var{filename};
otherwise, @code{.} uses the directories in @env{PATH} to find @var{filename}.
@var{filename} does not need to be executable.
When Bash is not in @sc{posix} mode, it searches the current directory When Bash is not in @sc{posix} mode, it searches the current directory
if @var{filename} is not found in @env{$PATH}. if @var{filename} is not found in @env{$PATH},
but does not search the current directory if @option{-p} is supplied.
If the @code{sourcepath} option (@pxref{The Shopt Builtin}) is turned off
@code{.} does not search @env{PATH}.
If any @var{arguments} are supplied, they become the positional If any @var{arguments} are supplied, they become the positional
parameters when @var{filename} is executed. Otherwise the positional parameters when @var{filename} is executed.
parameters are unchanged. Otherwise the positional parameters are unchanged.
If the @option{-T} option is enabled, @code{.} inherits any trap on If the @option{-T} option is enabled, @code{.} inherits any trap on
@code{DEBUG}; if it is not, any @code{DEBUG} trap string is saved and @code{DEBUG}; if it is not, any @code{DEBUG} trap string is saved and
restored around the call to @code{.}, and @code{.} unsets the restored around the call to @code{.}, and @code{.} unsets the
@@ -5231,7 +5237,7 @@ A synonym for @code{mapfile}.
@item source @item source
@btindex source @btindex source
@example @example
source @var{filename} source [-p @var{path}] @var{filename} [@var{arguments}]
@end example @end example
A synonym for @code{.} (@pxref{Bourne Shell Builtins}). A synonym for @code{.} (@pxref{Bourne Shell Builtins}).
@@ -6120,7 +6126,8 @@ number of positional parameters.
@item sourcepath @item sourcepath
If set, the @code{.} (@code{source}) builtin uses the value of @env{PATH} If set, the @code{.} (@code{source}) builtin uses the value of @env{PATH}
to find the directory containing the file supplied as an argument. to find the directory containing the file supplied as an argument
when the @option{-p} option is not supplied.
This option is enabled by default. This option is enabled by default.
@item varredir_close @item varredir_close
+808 -804
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2024 Free Software Foundation, Inc. Copyright (C) 1988-2024 Free Software Foundation, Inc.
@end ignore @end ignore
@set LASTCHANGE Tue Apr 23 15:08:20 EDT 2024 @set LASTCHANGE Wed Jun 12 10:34:52 PDT 2024
@set EDITION 5.3 @set EDITION 5.3
@set VERSION 5.3 @set VERSION 5.3
@set UPDATED 23 April 2024 @set UPDATED 12 June 2024
@set UPDATED-MONTH April 2024 @set UPDATED-MONTH June 2024
+3 -1
View File
@@ -5041,6 +5041,8 @@ cond_term (void)
} }
else else
parser_error (lineno, _("expected `)'")); parser_error (lineno, _("expected `)'"));
if (cond_token == WORD)
dispose_word (yylval.word);
COND_RETURN_ERROR (); COND_RETURN_ERROR ();
} }
term = make_cond_node (COND_EXPR, (WORD_DESC *)NULL, term, (COND_COM *)NULL); term = make_cond_node (COND_EXPR, (WORD_DESC *)NULL, term, (COND_COM *)NULL);
@@ -6642,7 +6644,7 @@ error_token_from_token (int tok)
t = (char *)NULL; t = (char *)NULL;
/* This stuff is dicy and needs closer inspection */ /* This stuff is dicy and needs closer inspection */
switch (current_token) switch (tok)
{ {
case WORD: case WORD:
case ASSIGNMENT_WORD: case ASSIGNMENT_WORD:
+20 -7
View File
@@ -139,6 +139,19 @@ abc
def def
ghi ghi
ok ok
./source8.sub: line 36: improbable-filename: No such file or directory
./source8.sub: line 37: improbable-filename: No such file or directory
an improbable filename
an improbable filename
an improbable filename
an improbable filename
file in the current directory
./source8.sub: line 51: .: cwd-filename: file not found
file in the current directory
bash: line 1: .: cwd-filename: file not found
bash: line 1: .: cwd-filename: file not found
file in the current directory
file in the current directory
AVAR AVAR
foo foo
foo foo
@@ -149,11 +162,11 @@ AVAR
foo foo
declare -x foo="" declare -x foo=""
declare -x FOO="\$\$" declare -x FOO="\$\$"
./builtins.tests: line 239: declare: FOO: not found ./builtins.tests: line 242: declare: FOO: not found
declare -x FOO="\$\$" declare -x FOO="\$\$"
ok ok
ok ok
./builtins.tests: line 271: kill: 4096: invalid signal specification ./builtins.tests: line 274: kill: 4096: invalid signal specification
1 1
a\n\n\nb a\n\n\nb
a a
@@ -332,7 +345,7 @@ A star (*) next to a name means that the command is disabled.
! PIPELINE history [-c] [-d offset] [n] or hist> ! PIPELINE history [-c] [-d offset] [n] or hist>
job_spec [&] if COMMANDS; then COMMANDS; [ elif C> job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
(( expression )) jobs [-lnprs] [jobspec ...] or jobs > (( expression )) jobs [-lnprs] [jobspec ...] or jobs >
. filename [arguments] kill [-s sigspec | -n signum | -sigs> . [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
: let arg [arg ...] : let arg [arg ...]
[ arg... ] local [option] name[=value] ... [ arg... ] local [option] name[=value] ...
[[ expression ]] logout [n] [[ expression ]] logout [n]
@@ -349,7 +362,7 @@ A star (*) next to a name means that the command is disabled.
complete [-abcdefgjksuv] [-pr] [-DEI]> set [-abefhkmnptuvxBCEHPT] [-o optio> complete [-abcdefgjksuv] [-pr] [-DEI]> set [-abefhkmnptuvxBCEHPT] [-o optio>
compopt [-o|+o option] [-DEI] [name .> shift [n] compopt [-o|+o option] [-DEI] [name .> shift [n]
continue [n] shopt [-pqsu] [-o] [optname ...] continue [n] shopt [-pqsu] [-o] [optname ...]
coproc [NAME] command [redirections] source filename [arguments] coproc [NAME] command [redirections] source [-p path] filename [argument>
declare [-aAfFgiIlnrtux] [name[=value> suspend [-f] declare [-aAfFgiIlnrtux] [name[=value> suspend [-f]
dirs [-clpv] [+N] [-N] test [expr] dirs [-clpv] [+N] [-N] test [expr]
disown [-h] [-ar] [jobspec ... | pid > time [-p] pipeline disown [-h] [-ar] [jobspec ... | pid > time [-p] pipeline
@@ -425,7 +438,7 @@ A star (*) next to a name means that the command is disabled.
! PIPELINE history [-c] [-d offset] [n] or hist> ! PIPELINE history [-c] [-d offset] [n] or hist>
job_spec [&] if COMMANDS; then COMMANDS; [ elif C> job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
(( expression )) jobs [-lnprs] [jobspec ...] or jobs > (( expression )) jobs [-lnprs] [jobspec ...] or jobs >
. filename [arguments] kill [-s sigspec | -n signum | -sigs> . [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
: let arg [arg ...] : let arg [arg ...]
[ arg... ] local [option] name[=value] ... [ arg... ] local [option] name[=value] ...
[[ expression ]] logout [n] [[ expression ]] logout [n]
@@ -442,7 +455,7 @@ A star (*) next to a name means that the command is disabled.
complete [-abcdefgjksuv] [-pr] [-DEI]> set [-abefhkmnptuvxBCEHPT] [-o optio> complete [-abcdefgjksuv] [-pr] [-DEI]> set [-abefhkmnptuvxBCEHPT] [-o optio>
compopt [-o|+o option] [-DEI] [name .> shift [n] compopt [-o|+o option] [-DEI] [name .> shift [n]
continue [n] shopt [-pqsu] [-o] [optname ...] continue [n] shopt [-pqsu] [-o] [optname ...]
coproc [NAME] command [redirections] source filename [arguments] coproc [NAME] command [redirections] source [-p path] filename [argument>
declare [-aAfFgiIlnrtux] [name[=value> suspend [-f] declare [-aAfFgiIlnrtux] [name[=value> suspend [-f]
dirs [-clpv] [+N] [-N] test [expr] dirs [-clpv] [+N] [-N] test [expr]
disown [-h] [-ar] [jobspec ... | pid > time [-p] pipeline disown [-h] [-ar] [jobspec ... | pid > time [-p] pipeline
@@ -489,5 +502,5 @@ popd: usage: popd [-n] [+N | -N]
./builtins12.sub: line 36: popd: +8: directory stack index out of range ./builtins12.sub: line 36: popd: +8: directory stack index out of range
/tmp / /tmp /
/ /
./builtins.tests: line 322: exit: status: numeric argument required ./builtins.tests: line 325: exit: status: numeric argument required
after non-numeric arg to exit: 2 after non-numeric arg to exit: 2
+3
View File
@@ -208,6 +208,9 @@ ${THIS_SH} ./source6.sub
# test bugs with source called from multiline aliases and other contexts # test bugs with source called from multiline aliases and other contexts
${THIS_SH} ./source7.sub ${THIS_SH} ./source7.sub
# test source/. -p path
${THIS_SH} ./source8.sub
# in posix mode, assignment statements preceding special builtins are # in posix mode, assignment statements preceding special builtins are
# reflected in the shell environment. `.' and `eval' need special-case # reflected in the shell environment. `.' and `eval' need special-case
# code. # code.
+2 -2
View File
@@ -157,7 +157,7 @@ bash: -c: line 1: unexpected token `EOF', expected `)'
bash: -c: line 2: syntax error: unexpected end of file bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: unexpected EOF while looking for `]]' bash: -c: line 1: unexpected EOF while looking for `]]'
bash: -c: line 2: syntax error: unexpected end of file bash: -c: line 2: syntax error: unexpected end of file
bash: -c: line 1: syntax error in conditional expression bash: -c: line 1: syntax error in conditional expression: unexpected token `]'
bash: -c: line 1: syntax error near `]' bash: -c: line 1: syntax error near `]'
bash: -c: line 1: `[[ ( -t X ) ]' bash: -c: line 1: `[[ ( -t X ) ]'
bash: -c: line 1: unexpected argument `&' to conditional unary operator bash: -c: line 1: unexpected argument `&' to conditional unary operator
@@ -178,7 +178,7 @@ bash: -c: line 1: `[[ 4 > & ]]'
bash: -c: line 1: unexpected token `&' in conditional command bash: -c: line 1: unexpected token `&' in conditional command
bash: -c: line 1: syntax error near `&' bash: -c: line 1: syntax error near `&'
bash: -c: line 1: `[[ & ]]' bash: -c: line 1: `[[ & ]]'
bash: -c: line 1: conditional binary operator expected bash: -c: line 1: unexpected token `7', conditional binary operator expected
bash: -c: line 1: syntax error near `7' bash: -c: line 1: syntax error near `7'
bash: -c: line 1: `[[ -Q 7 ]]' bash: -c: line 1: `[[ -Q 7 ]]'
bash: -c: line 1: unexpected argument `<' to conditional unary operator bash: -c: line 1: unexpected argument `<' to conditional unary operator
+5 -5
View File
@@ -81,11 +81,11 @@ bash: line 1: PWD: readonly variable
bash: line 1: OLDPWD: readonly variable bash: line 1: OLDPWD: readonly variable
1 1
./errors.tests: line 236: .: filename argument required ./errors.tests: line 236: .: filename argument required
.: usage: . filename [arguments] .: usage: . [-p path] filename [arguments]
./errors.tests: line 237: source: filename argument required ./errors.tests: line 237: source: filename argument required
source: usage: source filename [arguments] source: usage: source [-p path] filename [arguments]
./errors.tests: line 240: .: -i: invalid option ./errors.tests: line 240: .: -i: invalid option
.: usage: . filename [arguments] .: usage: . [-p path] filename [arguments]
./errors.tests: line 243: set: -q: invalid option ./errors.tests: line 243: set: -q: invalid option
set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...] set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 246: enable: sh: not a shell builtin ./errors.tests: line 246: enable: sh: not a shell builtin
@@ -141,7 +141,7 @@ set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...]
./errors.tests: line 348: xx: readonly variable ./errors.tests: line 348: xx: readonly variable
1 1
./errors1.sub: line 14: .: -i: invalid option ./errors1.sub: line 14: .: -i: invalid option
.: usage: . filename [arguments] .: usage: . [-p path] filename [arguments]
./errors1.sub: line 22: shift: -4: shift count out of range ./errors1.sub: line 22: shift: -4: shift count out of range
./errors1.sub: line 23: shift: -4: shift count out of range ./errors1.sub: line 23: shift: -4: shift count out of range
./errors1.sub: line 27: break: -1: loop count out of range ./errors1.sub: line 27: break: -1: loop count out of range
@@ -255,7 +255,7 @@ ok 6
./errors8.sub: line 16: /notthere: No such file or directory ./errors8.sub: line 16: /notthere: No such file or directory
ok 7 ok 7
./errors8.sub: line 17: .: -x: invalid option ./errors8.sub: line 17: .: -x: invalid option
.: usage: . filename [arguments] .: usage: . [-p path] filename [arguments]
ok 8 ok 8
DEBUG DEBUG
./errors9.sub: line 6: [[: ++: arithmetic syntax error: operand expected (error token is "+") ./errors9.sub: line 6: [[: ++: arithmetic syntax error: operand expected (error token is "+")
+62
View File
@@ -0,0 +1,62 @@
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# test various uses of source -p
: ${THIS_SH:=./bash}
PATH=/bin:/usr/bin:/sbin:/usr/sbin
: ${TMPDIR:=/var/tmp}
export SDIR=${TMPDIR}/source-$$
mkdir -p $SDIR || { echo "$SDIR: cannot create" >&2; exit 1; }
FN=${SDIR}/improbable-filename
cat >$FN << EOF
echo an improbable filename
EOF
cat >cwd-filename <<EOF
echo file in the current directory
EOF
trap 'rm -rf ${SDIR} ; rm -f cwd-filename' 0
# not found in $PATH
. improbable-filename
source improbable-filename
# searches path supplied with -p
. -p $SDIR:. improbable-filename
source -p $SDIR:. improbable-filename
# -p works even without sourcepath
shopt -u sourcepath
. -p $SDIR:. improbable-filename
source -p $SDIR:. improbable-filename
shopt -s sourcepath
# does not search the current directory with -p
. cwd-filename
. -p $SDIR cwd-filename
# but does if . is in the path argument
source -p $SDIR:. cwd-filename
# but does not in posix mode, where special builtins failing exits the shell
${THIS_SH} -c 'set -o posix ; . cwd-filename' bash
${THIS_SH} -c 'set -o posix ; . -p $SDIR cwd-filename' bash
# a null PATH argument is the same as "."
. -p '' cwd-filename
source -p '' cwd-filename