in posix mode, don't notify about other terminated jobs if the jobs builtin is listing individual jobs; in posix mode, if `wait pid' finds pid in bgpids, remove it from there

This commit is contained in:
Chet Ramey
2024-09-20 14:47:56 -04:00
parent bc5ddc8698
commit 8d74195d7f
18 changed files with 2564 additions and 2166 deletions
+34
View File
@@ -10194,3 +10194,37 @@ builtins/evalfile.c
jobs.c
- maybe_print_job_notifications: remove clause testing sourcelevel;
use want_job_notifications for this
9/11
----
[prayers for the victims of 9/11]
9/12
----
support/mkdep
- new version from Martin Kealey; modified for inclusion
Makefile.in
- MKDEP_ variables to be able to control various aspects of `make
depend'
9/13
----
configure.ac
- relstatus: update to `beta'
9/16
----
builtins/jobs.def
- jobs_builtin: when listing individial jobs, don't call notify_and_cleanup
(which notifies about outstanding terminated jobs) if the shell is
interactive and in posix mode
9/20
----
jobs.c
- wait_for_single_pid: if wait finds a status for the pid argument in
the bgp list, remove it from the bgp list if the shell is in posix
mode
+6 -1
View File
@@ -177,6 +177,11 @@ LSAN_CC = clang
LSAN_XCFLAGS = -fsanitize=leak -fno-common -fno-omit-frame-pointer -fno-optimize-sibling-calls
LSAN_XLDFLAGS = -fsanitize=leak
MKDEP = $(SUPPORT_SRC)mkdep
MKDEP_CC = ${CC}
MKDEP_OPTS = -c ${MKDEP_CC}
MKDEP_CCFLAGS = ${CCFLAGS}
INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC)
# Maybe add: -Wextra
@@ -1041,7 +1046,7 @@ xdist: force
depend: depends
depends: force
$(Program) $(SUPPORT_SRC)mkdep -c ${CC} -- ${CCFLAGS} ${CSOURCES}
$(Program) $(MKDEP) ${MKDEP_OPTS} -- ${MKDEP_CCFLAGS} ${CSOURCES}
#### PRIVATE TARGETS ####
hashtest: hashlib.c
+81 -66
View File
@@ -74,102 +74,117 @@ The following list is what's changed when 'POSIX mode' is in effect:
is stopped is 'Stopped(SIGNAME)', where SIGNAME is, for example,
SIGTSTP.
6. Alias expansion is always enabled, even in non-interactive shells.
6. If the shell is interactive, Bash does not perform job
notifications between executing commands in lists separated by ;
or newline. Non-interactive shells print status messages after a
foreground job in a list completes.
7. Reserved words appearing in a context where reserved words are
7. If the shell is interactive, Bash waits until the next prompt
before printing the status of a background job that changes status
or a foreground job that terminates due to a signal.
Non-interactive shells print status messages after a foreground job
completes.
8. Bash permanently removes jobs from the jobs table after notifying
the user of their termination, whether that is via wait, jobs,
or interactive shell notification before prompting.
9. Alias expansion is always enabled, even in non-interactive shells.
10. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
8. Alias expansion is performed when initially parsing a command
11. Alias expansion is performed when initially parsing a command
substitution. The default mode generally defers it, when enabled,
until the command substitution is executed. This means that
command substitution will not expand aliases that are defined after
the command substitution is initially parsed (e.g., as part of a
function definition).
9. The POSIX PS1 and PS2 expansions of ! to the history number
12. The POSIX PS1 and PS2 expansions of ! to the history number
and !! to ! are enabled, and parameter expansion is performed
on the values of PS1 and PS2 regardless of the setting of the
promptvars option.
10. The POSIX startup files are executed ($ENV) rather than the
13. The POSIX startup files are executed ($ENV) rather than the
normal Bash files.
11. Tilde expansion is only performed on assignments preceding a
14. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
12. The default history file is ~/.sh_history (this is the default
15. The default history file is ~/.sh_history (this is the default
value the shell assigns to $HISTFILE).
13. Redirection operators do not perform filename expansion on the
16. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
14. Redirection operators do not perform word splitting on the word in
17. Redirection operators do not perform word splitting on the word in
the redirection.
15. Function names must be valid shell names. That is, they may not
18. Function names must be valid shell names. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
16. Function names may not be the same as one of the POSIX special
19. Function names may not be the same as one of the POSIX special
builtins.
17. Even if a shell function whose name contains a slash was defined
20. Even if a shell function whose name contains a slash was defined
before entering POSIX mode, the shell will not execute a function
whose name contains one or more slashes.
18. POSIX special builtins are found before shell functions during
21. POSIX special builtins are found before shell functions during
command lookup, including output printed by the type and
command builtins.
19. When printing shell function definitions (e.g., by type), Bash
22. When printing shell function definitions (e.g., by type), Bash
does not print the function keyword.
20. Literal tildes that appear as the first character in elements of
23. Literal tildes that appear as the first character in elements of
the PATH variable are not expanded as described above under *note
Tilde Expansion::.
21. The time reserved word may be used by itself as a command. When
24. The time reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The TIMEFORMAT variable controls the
format of the timing information.
22. When parsing and expanding a ${...} expansion that appears within
25. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
23. The parser does not recognize time as a reserved word if the
26. The parser does not recognize time as a reserved word if the
next token begins with a -.
24. The ! character does not introduce history expansion within a
27. The ! character does not introduce history expansion within a
double-quoted string, even if the histexpand option is enabled.
25. If a POSIX special builtin returns an error status, a
28. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
26. The unset builtin with the -v option specified returns a fatal
29. The unset builtin with the -v option specified returns a fatal
error if it attempts to unset a readonly or non-unsettable
variable, or encounters a variable name argument that is an invalid
identifier, which causes a non-interactive shell to exit.
27. When asked to unset a variable that appears in an assignment
30. When asked to unset a variable that appears in an assignment
statement preceding the command, the unset builtin attempts to
unset a variable of the same name in the current or previous scope
as well. This implements the required "if an assigned variable is
further modified by the utility, the modifications made by the
utility shall persist" behavior.
28. A non-interactive shell exits with an error status if a variable
31. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
29. A non-interactive shell exits with an error status if a variable
32. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command. For any
other simple command, the shell aborts execution of that command,
@@ -177,166 +192,166 @@ The following list is what's changed when 'POSIX mode' is in effect:
perform any further processing of the command in which the error
occurred").
30. A non-interactive shell exits with an error status if the
33. A non-interactive shell exits with an error status if the
iteration variable in a for statement or the selection variable
in a select statement is a readonly variable or has an invalid
name.
31. Non-interactive shells exit if FILENAME in . FILENAME is not
34. Non-interactive shells exit if FILENAME in . FILENAME is not
found.
32. Non-interactive shells exit if a syntax error in an arithmetic
35. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
33. Non-interactive shells exit if a parameter expansion error occurs.
36. Non-interactive shells exit if a parameter expansion error occurs.
34. Non-interactive shells exit if there is a syntax error in a script
37. Non-interactive shells exit if there is a syntax error in a script
read with the . or source builtins, or in a string processed by
the eval builtin.
35. While variable indirection is available, it may not be applied to
38. While variable indirection is available, it may not be applied to
the # and ? special parameters.
36. Expanding the * special parameter in a pattern context where the
39. Expanding the * special parameter in a pattern context where the
expansion is double-quoted does not treat the $* as if it were
double-quoted.
37. Assignment statements preceding POSIX special builtins persist in
40. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
38. The command builtin does not prevent builtins that take
41. The command builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by command.
39. The bg builtin uses the required format to describe each job
42. The bg builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
40. The output of kill -l prints all the signal names on a single
43. The output of kill -l prints all the signal names on a single
line, separated by spaces, without the SIG prefix.
41. The kill builtin does not accept signal names with a SIG
44. The kill builtin does not accept signal names with a SIG
prefix.
42. The export and readonly builtin commands display their output
45. The export and readonly builtin commands display their output
in the format required by POSIX.
43. If the export and readonly builtin commands get an argument
46. If the export and readonly builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error. This will cause a non-interactive
shell to exit because these are special builtins.
44. The trap builtin displays signal names without the leading
47. The trap builtin displays signal names without the leading
SIG.
45. The trap builtin doesn't check the first argument for a possible
48. The trap builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use - as the first argument.
46. trap -p without arguments displays signals whose dispositions
49. trap -p without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
47. The . and source builtins do not search the current directory
50. The . and source builtins do not search the current directory
for the filename argument if it is not found by searching PATH.
48. Enabling POSIX mode has the effect of setting the
51. Enabling POSIX mode has the effect of setting the
inherit_errexit option, so subshells spawned to execute command
substitutions inherit the value of the -e option from the parent
shell. When the inherit_errexit option is not enabled, Bash
clears the -e option in such subshells.
49. Enabling POSIX mode has the effect of setting the shift_verbose
52. 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.
50. When the alias builtin displays alias definitions, it does not
53. When the alias builtin displays alias definitions, it does not
display them with a leading alias unless the -p option is
supplied.
51. When the set builtin is invoked without options, it does not
54. When the set builtin is invoked without options, it does not
display shell function names and definitions.
52. When the set builtin is invoked without options, it displays
55. 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.
53. When the cd builtin is invoked in logical mode, and the pathname
56. 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.
54. When the cd builtin cannot change a directory because the length
57. 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 canonicalized, cd
will attempt to use the supplied directory name.
55. The pwd builtin verifies that the value it prints is the same as
58. 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.
56. When listing the history, the fc builtin does not include an
59. When listing the history, the fc builtin does not include an
indication of whether or not a history entry has been modified.
57. The default editor used by fc is ed.
60. The default editor used by fc is ed.
58. fc treats extra arguments as an error instead of ignoring them.
61. fc treats extra arguments as an error instead of ignoring them.
59. If there are too many arguments supplied to fc -s, fc prints
62. If there are too many arguments supplied to fc -s, fc prints
an error message and returns failure.
60. The type and command builtins will not report a non-executable
63. 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.
61. The vi editing mode will invoke the vi editor directly when
64. The vi editing mode will invoke the vi editor directly when
the v command is run, instead of checking $VISUAL and
$EDITOR.
62. When the xpg_echo option is enabled, Bash does not attempt to
65. 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.
63. The ulimit builtin uses a block size of 512 bytes for the -c
66. The ulimit builtin uses a block size of 512 bytes for the -c
and -f options.
64. The arrival of SIGCHLD when a trap is set on SIGCHLD does not
67. 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.
65. The read builtin may be interrupted by a signal for which a trap
68. 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.
66. The printf builtin uses double (via strtod) to convert
69. The printf builtin uses double (via strtod) to convert
arguments corresponding to floating point conversion specifiers,
instead of long double if it's available. The L length
modifier forces printf to use long double if it's available.
67. Bash removes an exited background process's status from the list
70. Bash removes an exited background process's status from the list
of such statuses after the wait builtin is used to obtain it.
68. A double quote character (") is treated specially when it
71. A double quote character (") is treated specially when it
appears in a backquoted command substitution in the body of a
here-document that undergoes expansion. That means, for example,
that a backslash preceding a double quote character will escape it
and the backslash will be removed.
69. The test builtin compares strings using the current locale when
72. The test builtin compares strings using the current locale when
processing the < and > binary operators.
70. The test builtin's -t unary primary requires an argument.
73. The test builtin's -t unary primary requires an argument.
Historical versions of test made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
71. Command substitutions don't set the ? special parameter. The
74. Command substitutions don't set the ? special parameter. The
exit status of a simple command without a command word is still the
exit status of the last command substitution that occurred while
evaluating the variable assignments and redirections in that
+2 -1
View File
@@ -168,7 +168,8 @@ jobs_builtin (WORD_LIST *list)
}
/* POSIX says to remove terminated jobs from the list after the jobs
builtin reports their status. */
notify_and_cleanup (-1); /* XXX - why here? list_one_job already deletes dead jobs */
if (posixly_correct == 0 || interactive_shell == 0 || interactive == 0)
notify_and_cleanup (-1); /* XXX - why here? list_one_job already deletes dead jobs */
return (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
}
Vendored
+11 -11
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac for Bash 5.3, version 5.067.
# From configure.ac for Bash 5.3, version 5.068.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for bash 5.3-alpha.
# Generated by GNU Autoconf 2.72 for bash 5.3-beta.
#
# Report bugs to <bug-bash@gnu.org>.
#
@@ -605,8 +605,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bash'
PACKAGE_TARNAME='bash'
PACKAGE_VERSION='5.3-alpha'
PACKAGE_STRING='bash 5.3-alpha'
PACKAGE_VERSION='5.3-beta'
PACKAGE_STRING='bash 5.3-beta'
PACKAGE_BUGREPORT='bug-bash@gnu.org'
PACKAGE_URL=''
@@ -1463,7 +1463,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.3-alpha to adapt to many kinds of systems.
'configure' configures bash 5.3-beta to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1529,7 +1529,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bash 5.3-alpha:";;
short | recursive ) echo "Configuration of bash 5.3-beta:";;
esac
cat <<\_ACEOF
@@ -1735,7 +1735,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bash configure 5.3-alpha
bash configure 5.3-beta
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2413,7 +2413,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.3-alpha, which was
It was created by bash $as_me 5.3-beta, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3212,7 +3212,7 @@ ac_config_headers="$ac_config_headers config.h buildconf.h"
BASHVERS=5.3
RELSTATUS=alpha
RELSTATUS=beta
case "$RELSTATUS" in
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
@@ -23653,7 +23653,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.3-alpha, which was
This file was extended by bash $as_me 5.3-beta, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23721,7 +23721,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
bash config.status 5.3-alpha
bash config.status 5.3-beta
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
+2 -2
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.3, version 5.067])dnl
AC_REVISION([for Bash 5.3, version 5.068])dnl
define(bashvers, 5.3)
define(relstatus, alpha)
define(relstatus, beta)
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
+1695 -1695
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -5739,7 +5739,8 @@ Normally,
waits until it is about to print a prompt before reporting
changes in a job's status so as to not interrupt
any other output,
though it will notify of changes in a job's status after a command in
though it will notify of changes in a job's status after a
foreground command in
a list completes, before executing the next command.
If the
.B \-b
@@ -10857,7 +10858,8 @@ command and, if necessary, updates the values of
.B LINES
and
.SM
.BR COLUMNS .
.BR COLUMNS ,
using the file descriptor associated with stderr if it is a terminal.
This option is enabled by default.
.TP 8
.B cmdhist
+153 -147
View File
@@ -4965,7 +4965,9 @@ 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. This option is enabled by default.
LINES and COLUMNS, using the file descriptor associated
with stderr if it is a terminal. This option is enabled by
default.
cmdhist
If set, Bash attempts to save all lines of a multiple-line
@@ -7367,102 +7369,106 @@ startup files.
Non-interactive shells print status messages after a foreground job
completes.
8. Alias expansion is always enabled, even in non-interactive shells.
8. Bash permanently removes jobs from the jobs table after notifying
the user of their termination, whether that is via wait, jobs,
or interactive shell notification before prompting.
9. Reserved words appearing in a context where reserved words are
9. Alias expansion is always enabled, even in non-interactive shells.
10. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
10. Alias expansion is performed when initially parsing a command
11. Alias expansion is performed when initially parsing a command
substitution. The default mode generally defers it, when enabled,
until the command substitution is executed. This means that
command substitution will not expand aliases that are defined after
the command substitution is initially parsed (e.g., as part of a
function definition).
11. The POSIX PS1 and PS2 expansions of ! to the history number
12. The POSIX PS1 and PS2 expansions of ! to the history number
and !! to ! are enabled, and parameter expansion is performed
on the values of PS1 and PS2 regardless of the setting of the
promptvars option.
12. The POSIX startup files are executed ($ENV) rather than the
13. The POSIX startup files are executed ($ENV) rather than the
normal Bash files.
13. Tilde expansion is only performed on assignments preceding a
14. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
14. The default history file is ~/.sh_history (this is the default
15. The default history file is ~/.sh_history (this is the default
value the shell assigns to $HISTFILE).
15. Redirection operators do not perform filename expansion on the
16. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
16. Redirection operators do not perform word splitting on the word in
17. Redirection operators do not perform word splitting on the word in
the redirection.
17. Function names must be valid shell names. That is, they may not
18. Function names must be valid shell names. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
18. Function names may not be the same as one of the POSIX special
19. Function names may not be the same as one of the POSIX special
builtins.
19. Even if a shell function whose name contains a slash was defined
20. Even if a shell function whose name contains a slash was defined
before entering POSIX mode, the shell will not execute a function
whose name contains one or more slashes.
20. POSIX special builtins are found before shell functions during
21. POSIX special builtins are found before shell functions during
command lookup, including output printed by the type and
command builtins.
21. When printing shell function definitions (e.g., by type), Bash
22. When printing shell function definitions (e.g., by type), Bash
does not print the function keyword.
22. Literal tildes that appear as the first character in elements of
23. Literal tildes that appear as the first character in elements of
the PATH variable are not expanded as described above under *note
Tilde Expansion::.
23. The time reserved word may be used by itself as a command. When
24. The time reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The TIMEFORMAT variable controls the
format of the timing information.
24. When parsing and expanding a ${...} expansion that appears within
25. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
25. The parser does not recognize time as a reserved word if the
26. The parser does not recognize time as a reserved word if the
next token begins with a -.
26. The ! character does not introduce history expansion within a
27. The ! character does not introduce history expansion within a
double-quoted string, even if the histexpand option is enabled.
27. If a POSIX special builtin returns an error status, a
28. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
28. The unset builtin with the -v option specified returns a fatal
29. The unset builtin with the -v option specified returns a fatal
error if it attempts to unset a readonly or non-unsettable
variable, or encounters a variable name argument that is an invalid
identifier, which causes a non-interactive shell to exit.
29. When asked to unset a variable that appears in an assignment
30. When asked to unset a variable that appears in an assignment
statement preceding the command, the unset builtin attempts to
unset a variable of the same name in the current or previous scope
as well. This implements the required "if an assigned variable is
further modified by the utility, the modifications made by the
utility shall persist" behavior.
30. A non-interactive shell exits with an error status if a variable
31. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
31. A non-interactive shell exits with an error status if a variable
32. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command. For any
other simple command, the shell aborts execution of that command,
@@ -7470,166 +7476,166 @@ startup files.
perform any further processing of the command in which the error
occurred").
32. A non-interactive shell exits with an error status if the
33. A non-interactive shell exits with an error status if the
iteration variable in a for statement or the selection variable
in a select statement is a readonly variable or has an invalid
name.
33. Non-interactive shells exit if FILENAME in . FILENAME is not
34. Non-interactive shells exit if FILENAME in . FILENAME is not
found.
34. Non-interactive shells exit if a syntax error in an arithmetic
35. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
35. Non-interactive shells exit if a parameter expansion error occurs.
36. Non-interactive shells exit if a parameter expansion error occurs.
36. Non-interactive shells exit if there is a syntax error in a script
37. Non-interactive shells exit if there is a syntax error in a script
read with the . or source builtins, or in a string processed by
the eval builtin.
37. While variable indirection is available, it may not be applied to
38. While variable indirection is available, it may not be applied to
the # and ? special parameters.
38. Expanding the * special parameter in a pattern context where the
39. Expanding the * special parameter in a pattern context where the
expansion is double-quoted does not treat the $* as if it were
double-quoted.
39. Assignment statements preceding POSIX special builtins persist in
40. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
40. The command builtin does not prevent builtins that take
41. The command builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by command.
41. The bg builtin uses the required format to describe each job
42. The bg builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
42. The output of kill -l prints all the signal names on a single
43. The output of kill -l prints all the signal names on a single
line, separated by spaces, without the SIG prefix.
43. The kill builtin does not accept signal names with a SIG
44. The kill builtin does not accept signal names with a SIG
prefix.
44. The export and readonly builtin commands display their output
45. The export and readonly builtin commands display their output
in the format required by POSIX.
45. If the export and readonly builtin commands get an argument
46. If the export and readonly builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error. This will cause a non-interactive
shell to exit because these are special builtins.
46. The trap builtin displays signal names without the leading
47. The trap builtin displays signal names without the leading
SIG.
47. The trap builtin doesn't check the first argument for a possible
48. The trap builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use - as the first argument.
48. trap -p without arguments displays signals whose dispositions
49. trap -p without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
49. The . and source builtins do not search the current directory
50. The . and source builtins do not search the current directory
for the filename argument if it is not found by searching PATH.
50. Enabling POSIX mode has the effect of setting the
51. Enabling POSIX mode has the effect of setting the
inherit_errexit option, so subshells spawned to execute command
substitutions inherit the value of the -e option from the parent
shell. When the inherit_errexit option is not enabled, Bash
clears the -e option in such subshells.
51. Enabling POSIX mode has the effect of setting the shift_verbose
52. 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.
52. When the alias builtin displays alias definitions, it does not
53. When the alias builtin displays alias definitions, it does not
display them with a leading alias unless the -p option is
supplied.
53. When the set builtin is invoked without options, it does not
54. When the set builtin is invoked without options, it does not
display shell function names and definitions.
54. When the set builtin is invoked without options, it displays
55. 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.
55. When the cd builtin is invoked in logical mode, and the pathname
56. 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.
56. When the cd builtin cannot change a directory because the length
57. 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 canonicalized, cd
will attempt to use the supplied directory name.
57. The pwd builtin verifies that the value it prints is the same as
58. 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.
58. When listing the history, the fc builtin does not include an
59. When listing the history, the fc builtin does not include an
indication of whether or not a history entry has been modified.
59. The default editor used by fc is ed.
60. The default editor used by fc is ed.
60. fc treats extra arguments as an error instead of ignoring them.
61. fc treats extra arguments as an error instead of ignoring them.
61. If there are too many arguments supplied to fc -s, fc prints
62. If there are too many arguments supplied to fc -s, fc prints
an error message and returns failure.
62. The type and command builtins will not report a non-executable
63. 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.
63. The vi editing mode will invoke the vi editor directly when
64. The vi editing mode will invoke the vi editor directly when
the v command is run, instead of checking $VISUAL and
$EDITOR.
64. When the xpg_echo option is enabled, Bash does not attempt to
65. 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.
65. The ulimit builtin uses a block size of 512 bytes for the -c
66. The ulimit builtin uses a block size of 512 bytes for the -c
and -f options.
66. The arrival of SIGCHLD when a trap is set on SIGCHLD does not
67. 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.
67. The read builtin may be interrupted by a signal for which a trap
68. 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.
68. The printf builtin uses double (via strtod) to convert
69. The printf builtin uses double (via strtod) to convert
arguments corresponding to floating point conversion specifiers,
instead of long double if it's available. The L length
modifier forces printf to use long double if it's available.
69. Bash removes an exited background process's status from the list
70. Bash removes an exited background process's status from the list
of such statuses after the wait builtin is used to obtain it.
70. A double quote character (") is treated specially when it
71. A double quote character (") is treated specially when it
appears in a backquoted command substitution in the body of a
here-document that undergoes expansion. That means, for example,
that a backslash preceding a double quote character will escape it
and the backslash will be removed.
71. The test builtin compares strings using the current locale when
72. The test builtin compares strings using the current locale when
processing the < and > binary operators.
72. The test builtin's -t unary primary requires an argument.
73. The test builtin's -t unary primary requires an argument.
Historical versions of test made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
73. Command substitutions don't set the ? special parameter. The
74. Command substitutions don't set the ? special parameter. The
exit status of a simple command without a command word is still the
exit status of the last command substitution that occurred while
evaluating the variable assignments and redirections in that
@@ -7911,11 +7917,11 @@ equivalent to bg %1
The shell learns immediately whenever a job changes state. Normally,
Bash waits until it is about to print a prompt before reporting changes
in a job's status so as to not interrupt any other output, though it
will notify of changes in a job's status after a command in a list
completes, before executing the next command. If the -b option to the
set builtin is enabled, Bash reports such changes immediately (*note
The Set Builtin::). Any trap on SIGCHLD is executed for each child
process that exits.
will notify of changes in a job's status after a foreground command in a
list completes, before executing the next command. If the -b option
to the set builtin is enabled, Bash reports such changes immediately
(*note The Set Builtin::). Any trap on SIGCHLD is executed for each
child process that exits.
If an attempt to exit Bash is made while jobs are stopped, (or
running, if the checkjobs option is enabled - see *note The Shopt
@@ -13118,81 +13124,81 @@ Node: Bash Builtins170872
Node: Modifying Shell Behavior205971
Node: The Set Builtin206313
Node: The Shopt Builtin217896
Node: Special Builtins234858
Node: Shell Variables235847
Node: Bourne Shell Variables236281
Node: Bash Variables238474
Node: Bash Features275669
Node: Invoking Bash276683
Node: Bash Startup Files283082
Node: Interactive Shells288385
Node: What is an Interactive Shell?288793
Node: Is this Shell Interactive?289459
Node: Interactive Shell Behavior290283
Node: Bash Conditional Expressions294037
Node: Shell Arithmetic299211
Node: Aliases302293
Node: Arrays305248
Node: The Directory Stack312047
Node: Directory Stack Builtins312844
Node: Controlling the Prompt317293
Node: The Restricted Shell320431
Node: Bash POSIX Mode323218
Node: Shell Compatibility Mode341267
Node: Job Control350218
Node: Job Control Basics350675
Node: Job Control Builtins355972
Node: Job Control Variables361916
Node: Command Line Editing363093
Node: Introduction and Notation364797
Node: Readline Interaction366892
Node: Readline Bare Essentials368080
Node: Readline Movement Commands369898
Node: Readline Killing Commands370895
Node: Readline Arguments372873
Node: Searching373930
Node: Readline Init File376159
Node: Readline Init File Syntax377441
Node: Conditional Init Constructs403981
Node: Sample Init File408346
Node: Bindable Readline Commands411467
Node: Commands For Moving412692
Node: Commands For History414919
Node: Commands For Text420124
Node: Commands For Killing424258
Node: Numeric Arguments427059
Node: Commands For Completion428211
Node: Keyboard Macros432527
Node: Miscellaneous Commands433228
Node: Readline vi Mode439882
Node: Programmable Completion440834
Node: Programmable Completion Builtins448791
Node: A Programmable Completion Example460357
Node: Using History Interactively465702
Node: Bash History Facilities466383
Node: Bash History Builtins469495
Node: History Interaction474738
Node: Event Designators479063
Node: Word Designators480646
Node: Modifiers482798
Node: Installing Bash484707
Node: Basic Installation485841
Node: Compilers and Options489720
Node: Compiling For Multiple Architectures490470
Node: Installation Names492219
Node: Specifying the System Type494453
Node: Sharing Defaults495199
Node: Operation Controls495913
Node: Optional Features496932
Node: Reporting Bugs508734
Node: Major Differences From The Bourne Shell510083
Node: GNU Free Documentation License529818
Node: Indexes554995
Node: Builtin Index555446
Node: Reserved Word Index562544
Node: Variable Index564989
Node: Function Index582261
Node: Concept Index596117
Node: Special Builtins234948
Node: Shell Variables235937
Node: Bourne Shell Variables236371
Node: Bash Variables238564
Node: Bash Features275759
Node: Invoking Bash276773
Node: Bash Startup Files283172
Node: Interactive Shells288475
Node: What is an Interactive Shell?288883
Node: Is this Shell Interactive?289549
Node: Interactive Shell Behavior290373
Node: Bash Conditional Expressions294127
Node: Shell Arithmetic299301
Node: Aliases302383
Node: Arrays305338
Node: The Directory Stack312137
Node: Directory Stack Builtins312934
Node: Controlling the Prompt317383
Node: The Restricted Shell320521
Node: Bash POSIX Mode323308
Node: Shell Compatibility Mode341567
Node: Job Control350518
Node: Job Control Basics350975
Node: Job Control Builtins356283
Node: Job Control Variables362227
Node: Command Line Editing363404
Node: Introduction and Notation365108
Node: Readline Interaction367203
Node: Readline Bare Essentials368391
Node: Readline Movement Commands370209
Node: Readline Killing Commands371206
Node: Readline Arguments373184
Node: Searching374241
Node: Readline Init File376470
Node: Readline Init File Syntax377752
Node: Conditional Init Constructs404292
Node: Sample Init File408657
Node: Bindable Readline Commands411778
Node: Commands For Moving413003
Node: Commands For History415230
Node: Commands For Text420435
Node: Commands For Killing424569
Node: Numeric Arguments427370
Node: Commands For Completion428522
Node: Keyboard Macros432838
Node: Miscellaneous Commands433539
Node: Readline vi Mode440193
Node: Programmable Completion441145
Node: Programmable Completion Builtins449102
Node: A Programmable Completion Example460668
Node: Using History Interactively466013
Node: Bash History Facilities466694
Node: Bash History Builtins469806
Node: History Interaction475049
Node: Event Designators479374
Node: Word Designators480957
Node: Modifiers483109
Node: Installing Bash485018
Node: Basic Installation486152
Node: Compilers and Options490031
Node: Compiling For Multiple Architectures490781
Node: Installation Names492530
Node: Specifying the System Type494764
Node: Sharing Defaults495510
Node: Operation Controls496224
Node: Optional Features497243
Node: Reporting Bugs509045
Node: Major Differences From The Bourne Shell510394
Node: GNU Free Documentation License530129
Node: Indexes555306
Node: Builtin Index555757
Node: Reserved Word Index562855
Node: Variable Index565300
Node: Function Index582572
Node: Concept Index596428

End Tag Table
+153 -147
View File
@@ -4966,7 +4966,9 @@ 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. This option is enabled by default.
LINES and COLUMNS, using the file descriptor associated
with stderr if it is a terminal. This option is enabled by
default.
cmdhist
If set, Bash attempts to save all lines of a multiple-line
@@ -7368,102 +7370,106 @@ startup files.
Non-interactive shells print status messages after a foreground job
completes.
8. Alias expansion is always enabled, even in non-interactive shells.
8. Bash permanently removes jobs from the jobs table after notifying
the user of their termination, whether that is via wait, jobs,
or interactive shell notification before prompting.
9. Reserved words appearing in a context where reserved words are
9. Alias expansion is always enabled, even in non-interactive shells.
10. Reserved words appearing in a context where reserved words are
recognized do not undergo alias expansion.
10. Alias expansion is performed when initially parsing a command
11. Alias expansion is performed when initially parsing a command
substitution. The default mode generally defers it, when enabled,
until the command substitution is executed. This means that
command substitution will not expand aliases that are defined after
the command substitution is initially parsed (e.g., as part of a
function definition).
11. The POSIX PS1 and PS2 expansions of ! to the history number
12. The POSIX PS1 and PS2 expansions of ! to the history number
and !! to ! are enabled, and parameter expansion is performed
on the values of PS1 and PS2 regardless of the setting of the
promptvars option.
12. The POSIX startup files are executed ($ENV) rather than the
13. The POSIX startup files are executed ($ENV) rather than the
normal Bash files.
13. Tilde expansion is only performed on assignments preceding a
14. Tilde expansion is only performed on assignments preceding a
command name, rather than on all assignment statements on the line.
14. The default history file is ~/.sh_history (this is the default
15. The default history file is ~/.sh_history (this is the default
value the shell assigns to $HISTFILE).
15. Redirection operators do not perform filename expansion on the
16. Redirection operators do not perform filename expansion on the
word in the redirection unless the shell is interactive.
16. Redirection operators do not perform word splitting on the word in
17. Redirection operators do not perform word splitting on the word in
the redirection.
17. Function names must be valid shell names. That is, they may not
18. Function names must be valid shell names. That is, they may not
contain characters other than letters, digits, and underscores, and
may not start with a digit. Declaring a function with an invalid
name causes a fatal syntax error in non-interactive shells.
18. Function names may not be the same as one of the POSIX special
19. Function names may not be the same as one of the POSIX special
builtins.
19. Even if a shell function whose name contains a slash was defined
20. Even if a shell function whose name contains a slash was defined
before entering POSIX mode, the shell will not execute a function
whose name contains one or more slashes.
20. POSIX special builtins are found before shell functions during
21. POSIX special builtins are found before shell functions during
command lookup, including output printed by the type and
command builtins.
21. When printing shell function definitions (e.g., by type), Bash
22. When printing shell function definitions (e.g., by type), Bash
does not print the function keyword.
22. Literal tildes that appear as the first character in elements of
23. Literal tildes that appear as the first character in elements of
the PATH variable are not expanded as described above under *note
Tilde Expansion::.
23. The time reserved word may be used by itself as a command. When
24. The time reserved word may be used by itself as a command. When
used in this way, it displays timing statistics for the shell and
its completed children. The TIMEFORMAT variable controls the
format of the timing information.
24. When parsing and expanding a ${...} expansion that appears within
25. When parsing and expanding a ${...} expansion that appears within
double quotes, single quotes are no longer special and cannot be
used to quote a closing brace or other special character, unless
the operator is one of those defined to perform pattern removal.
In this case, they do not have to appear as matched pairs.
25. The parser does not recognize time as a reserved word if the
26. The parser does not recognize time as a reserved word if the
next token begins with a -.
26. The ! character does not introduce history expansion within a
27. The ! character does not introduce history expansion within a
double-quoted string, even if the histexpand option is enabled.
27. If a POSIX special builtin returns an error status, a
28. If a POSIX special builtin returns an error status, a
non-interactive shell exits. The fatal errors are those listed in
the POSIX standard, and include things like passing incorrect
options, redirection errors, variable assignment errors for
assignments preceding the command name, and so on.
28. The unset builtin with the -v option specified returns a fatal
29. The unset builtin with the -v option specified returns a fatal
error if it attempts to unset a readonly or non-unsettable
variable, or encounters a variable name argument that is an invalid
identifier, which causes a non-interactive shell to exit.
29. When asked to unset a variable that appears in an assignment
30. When asked to unset a variable that appears in an assignment
statement preceding the command, the unset builtin attempts to
unset a variable of the same name in the current or previous scope
as well. This implements the required "if an assigned variable is
further modified by the utility, the modifications made by the
utility shall persist" behavior.
30. A non-interactive shell exits with an error status if a variable
31. A non-interactive shell exits with an error status if a variable
assignment error occurs when no command name follows the assignment
statements. A variable assignment error occurs, for example, when
trying to assign a value to a readonly variable.
31. A non-interactive shell exits with an error status if a variable
32. A non-interactive shell exits with an error status if a variable
assignment error occurs in an assignment statement preceding a
special builtin, but not with any other simple command. For any
other simple command, the shell aborts execution of that command,
@@ -7471,166 +7477,166 @@ startup files.
perform any further processing of the command in which the error
occurred").
32. A non-interactive shell exits with an error status if the
33. A non-interactive shell exits with an error status if the
iteration variable in a for statement or the selection variable
in a select statement is a readonly variable or has an invalid
name.
33. Non-interactive shells exit if FILENAME in . FILENAME is not
34. Non-interactive shells exit if FILENAME in . FILENAME is not
found.
34. Non-interactive shells exit if a syntax error in an arithmetic
35. Non-interactive shells exit if a syntax error in an arithmetic
expansion results in an invalid expression.
35. Non-interactive shells exit if a parameter expansion error occurs.
36. Non-interactive shells exit if a parameter expansion error occurs.
36. Non-interactive shells exit if there is a syntax error in a script
37. Non-interactive shells exit if there is a syntax error in a script
read with the . or source builtins, or in a string processed by
the eval builtin.
37. While variable indirection is available, it may not be applied to
38. While variable indirection is available, it may not be applied to
the # and ? special parameters.
38. Expanding the * special parameter in a pattern context where the
39. Expanding the * special parameter in a pattern context where the
expansion is double-quoted does not treat the $* as if it were
double-quoted.
39. Assignment statements preceding POSIX special builtins persist in
40. Assignment statements preceding POSIX special builtins persist in
the shell environment after the builtin completes.
40. The command builtin does not prevent builtins that take
41. The command builtin does not prevent builtins that take
assignment statements as arguments from expanding them as
assignment statements; when not in POSIX mode, assignment builtins
lose their assignment statement expansion properties when preceded
by command.
41. The bg builtin uses the required format to describe each job
42. The bg builtin uses the required format to describe each job
placed in the background, which does not include an indication of
whether the job is the current or previous job.
42. The output of kill -l prints all the signal names on a single
43. The output of kill -l prints all the signal names on a single
line, separated by spaces, without the SIG prefix.
43. The kill builtin does not accept signal names with a SIG
44. The kill builtin does not accept signal names with a SIG
prefix.
44. The export and readonly builtin commands display their output
45. The export and readonly builtin commands display their output
in the format required by POSIX.
45. If the export and readonly builtin commands get an argument
46. If the export and readonly builtin commands get an argument
that is not a valid identifier, and they are not operating on shell
functions, they return an error. This will cause a non-interactive
shell to exit because these are special builtins.
46. The trap builtin displays signal names without the leading
47. The trap builtin displays signal names without the leading
SIG.
47. The trap builtin doesn't check the first argument for a possible
48. The trap builtin doesn't check the first argument for a possible
signal specification and revert the signal handling to the original
disposition if it is, unless that argument consists solely of
digits and is a valid signal number. If users want to reset the
handler for a given signal to the original disposition, they should
use - as the first argument.
48. trap -p without arguments displays signals whose dispositions
49. trap -p without arguments displays signals whose dispositions
are set to SIG_DFL and those that were ignored when the shell
started, not just trapped signals.
49. The . and source builtins do not search the current directory
50. The . and source builtins do not search the current directory
for the filename argument if it is not found by searching PATH.
50. Enabling POSIX mode has the effect of setting the
51. Enabling POSIX mode has the effect of setting the
inherit_errexit option, so subshells spawned to execute command
substitutions inherit the value of the -e option from the parent
shell. When the inherit_errexit option is not enabled, Bash
clears the -e option in such subshells.
51. Enabling POSIX mode has the effect of setting the shift_verbose
52. 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.
52. When the alias builtin displays alias definitions, it does not
53. When the alias builtin displays alias definitions, it does not
display them with a leading alias unless the -p option is
supplied.
53. When the set builtin is invoked without options, it does not
54. When the set builtin is invoked without options, it does not
display shell function names and definitions.
54. When the set builtin is invoked without options, it displays
55. 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.
55. When the cd builtin is invoked in logical mode, and the pathname
56. 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.
56. When the cd builtin cannot change a directory because the length
57. 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 canonicalized, cd
will attempt to use the supplied directory name.
57. The pwd builtin verifies that the value it prints is the same as
58. 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.
58. When listing the history, the fc builtin does not include an
59. When listing the history, the fc builtin does not include an
indication of whether or not a history entry has been modified.
59. The default editor used by fc is ed.
60. The default editor used by fc is ed.
60. fc treats extra arguments as an error instead of ignoring them.
61. fc treats extra arguments as an error instead of ignoring them.
61. If there are too many arguments supplied to fc -s, fc prints
62. If there are too many arguments supplied to fc -s, fc prints
an error message and returns failure.
62. The type and command builtins will not report a non-executable
63. 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.
63. The vi editing mode will invoke the vi editor directly when
64. The vi editing mode will invoke the vi editor directly when
the v command is run, instead of checking $VISUAL and
$EDITOR.
64. When the xpg_echo option is enabled, Bash does not attempt to
65. 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.
65. The ulimit builtin uses a block size of 512 bytes for the -c
66. The ulimit builtin uses a block size of 512 bytes for the -c
and -f options.
66. The arrival of SIGCHLD when a trap is set on SIGCHLD does not
67. 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.
67. The read builtin may be interrupted by a signal for which a trap
68. 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.
68. The printf builtin uses double (via strtod) to convert
69. The printf builtin uses double (via strtod) to convert
arguments corresponding to floating point conversion specifiers,
instead of long double if it's available. The L length
modifier forces printf to use long double if it's available.
69. Bash removes an exited background process's status from the list
70. Bash removes an exited background process's status from the list
of such statuses after the wait builtin is used to obtain it.
70. A double quote character (") is treated specially when it
71. A double quote character (") is treated specially when it
appears in a backquoted command substitution in the body of a
here-document that undergoes expansion. That means, for example,
that a backslash preceding a double quote character will escape it
and the backslash will be removed.
71. The test builtin compares strings using the current locale when
72. The test builtin compares strings using the current locale when
processing the < and > binary operators.
72. The test builtin's -t unary primary requires an argument.
73. The test builtin's -t unary primary requires an argument.
Historical versions of test made the argument optional in certain
cases, and Bash attempts to accommodate those for backwards
compatibility.
73. Command substitutions don't set the ? special parameter. The
74. Command substitutions don't set the ? special parameter. The
exit status of a simple command without a command word is still the
exit status of the last command substitution that occurred while
evaluating the variable assignments and redirections in that
@@ -7912,11 +7918,11 @@ equivalent to bg %1
The shell learns immediately whenever a job changes state. Normally,
Bash waits until it is about to print a prompt before reporting changes
in a job's status so as to not interrupt any other output, though it
will notify of changes in a job's status after a command in a list
completes, before executing the next command. If the -b option to the
set builtin is enabled, Bash reports such changes immediately (*note
The Set Builtin::). Any trap on SIGCHLD is executed for each child
process that exits.
will notify of changes in a job's status after a foreground command in a
list completes, before executing the next command. If the -b option
to the set builtin is enabled, Bash reports such changes immediately
(*note The Set Builtin::). Any trap on SIGCHLD is executed for each
child process that exits.
If an attempt to exit Bash is made while jobs are stopped, (or
running, if the checkjobs option is enabled - see *note The Shopt
@@ -13119,81 +13125,81 @@ Node: Bash Builtins171034
Node: Modifying Shell Behavior206136
Node: The Set Builtin206481
Node: The Shopt Builtin218067
Node: Special Builtins235032
Node: Shell Variables236024
Node: Bourne Shell Variables236461
Node: Bash Variables238657
Node: Bash Features275855
Node: Invoking Bash276872
Node: Bash Startup Files283274
Node: Interactive Shells288580
Node: What is an Interactive Shell?288991
Node: Is this Shell Interactive?289660
Node: Interactive Shell Behavior290487
Node: Bash Conditional Expressions294244
Node: Shell Arithmetic299421
Node: Aliases302506
Node: Arrays305464
Node: The Directory Stack312266
Node: Directory Stack Builtins313066
Node: Controlling the Prompt317518
Node: The Restricted Shell320659
Node: Bash POSIX Mode323449
Node: Shell Compatibility Mode341501
Node: Job Control350455
Node: Job Control Basics350915
Node: Job Control Builtins356215
Node: Job Control Variables362162
Node: Command Line Editing363342
Node: Introduction and Notation365049
Node: Readline Interaction367147
Node: Readline Bare Essentials368338
Node: Readline Movement Commands370159
Node: Readline Killing Commands371159
Node: Readline Arguments373140
Node: Searching374200
Node: Readline Init File376432
Node: Readline Init File Syntax377717
Node: Conditional Init Constructs404260
Node: Sample Init File408628
Node: Bindable Readline Commands411752
Node: Commands For Moving412980
Node: Commands For History415210
Node: Commands For Text420418
Node: Commands For Killing424555
Node: Numeric Arguments427359
Node: Commands For Completion428514
Node: Keyboard Macros432833
Node: Miscellaneous Commands433537
Node: Readline vi Mode440194
Node: Programmable Completion441149
Node: Programmable Completion Builtins449109
Node: A Programmable Completion Example460678
Node: Using History Interactively466026
Node: Bash History Facilities466710
Node: Bash History Builtins469825
Node: History Interaction475071
Node: Event Designators479399
Node: Word Designators480985
Node: Modifiers483140
Node: Installing Bash485052
Node: Basic Installation486189
Node: Compilers and Options490071
Node: Compiling For Multiple Architectures490824
Node: Installation Names492576
Node: Specifying the System Type494813
Node: Sharing Defaults495562
Node: Operation Controls496279
Node: Optional Features497301
Node: Reporting Bugs509106
Node: Major Differences From The Bourne Shell510458
Node: GNU Free Documentation License530196
Node: Indexes555376
Node: Builtin Index555830
Node: Reserved Word Index562931
Node: Variable Index565379
Node: Function Index582654
Node: Concept Index596513
Node: Special Builtins235122
Node: Shell Variables236114
Node: Bourne Shell Variables236551
Node: Bash Variables238747
Node: Bash Features275945
Node: Invoking Bash276962
Node: Bash Startup Files283364
Node: Interactive Shells288670
Node: What is an Interactive Shell?289081
Node: Is this Shell Interactive?289750
Node: Interactive Shell Behavior290577
Node: Bash Conditional Expressions294334
Node: Shell Arithmetic299511
Node: Aliases302596
Node: Arrays305554
Node: The Directory Stack312356
Node: Directory Stack Builtins313156
Node: Controlling the Prompt317608
Node: The Restricted Shell320749
Node: Bash POSIX Mode323539
Node: Shell Compatibility Mode341801
Node: Job Control350755
Node: Job Control Basics351215
Node: Job Control Builtins356526
Node: Job Control Variables362473
Node: Command Line Editing363653
Node: Introduction and Notation365360
Node: Readline Interaction367458
Node: Readline Bare Essentials368649
Node: Readline Movement Commands370470
Node: Readline Killing Commands371470
Node: Readline Arguments373451
Node: Searching374511
Node: Readline Init File376743
Node: Readline Init File Syntax378028
Node: Conditional Init Constructs404571
Node: Sample Init File408939
Node: Bindable Readline Commands412063
Node: Commands For Moving413291
Node: Commands For History415521
Node: Commands For Text420729
Node: Commands For Killing424866
Node: Numeric Arguments427670
Node: Commands For Completion428825
Node: Keyboard Macros433144
Node: Miscellaneous Commands433848
Node: Readline vi Mode440505
Node: Programmable Completion441460
Node: Programmable Completion Builtins449420
Node: A Programmable Completion Example460989
Node: Using History Interactively466337
Node: Bash History Facilities467021
Node: Bash History Builtins470136
Node: History Interaction475382
Node: Event Designators479710
Node: Word Designators481296
Node: Modifiers483451
Node: Installing Bash485363
Node: Basic Installation486500
Node: Compilers and Options490382
Node: Compiling For Multiple Architectures491135
Node: Installation Names492887
Node: Specifying the System Type495124
Node: Sharing Defaults495873
Node: Operation Controls496590
Node: Optional Features497612
Node: Reporting Bugs509417
Node: Major Differences From The Bourne Shell510769
Node: GNU Free Documentation License530507
Node: Indexes555687
Node: Builtin Index556141
Node: Reserved Word Index563242
Node: Variable Index565690
Node: Function Index582965
Node: Concept Index596824

End Tag Table
+9 -2
View File
@@ -5847,7 +5847,8 @@ The shell always postpones exiting if any jobs are stopped.
@item checkwinsize
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}.
@env{LINES} and @env{COLUMNS},
using the file descriptor associated with stderr if it is a terminal.
This option is enabled by default.
@item cmdhist
@@ -8555,6 +8556,11 @@ printing the status of a background job that changes status or a foreground
job that terminates due to a signal.
Non-interactive shells print status messages after a foreground job completes.
@item
Bash permanently removes jobs from the jobs table after notifying the
user of their termination, whether that is via @code{wait}, @code{jobs},
or interactive shell notification before prompting.
@item
Alias expansion is always enabled, even in non-interactive shells.
@@ -9244,7 +9250,8 @@ The shell learns immediately whenever a job changes state.
Normally, Bash waits until it is about to print a prompt
before reporting changes in a job's status so as to not interrupt
any other output,
though it will notify of changes in a job's status after a command in
though it will notify of changes in a job's status after a
foreground command in
a list completes, before executing the next command.
If the @option{-b} option to the @code{set} builtin is enabled,
Bash reports such changes immediately (@pxref{The Set Builtin}).
+6 -2
View File
@@ -2740,7 +2740,11 @@ wait_for_single_pid (pid_t pid, int flags)
{
r = bgp_search (pid);
if (r >= 0)
return r;
{
if (posixly_correct)
bgp_delete (pid);
return r;
}
}
if (child == 0)
@@ -3374,7 +3378,7 @@ if (job == NO_JOB)
the shell is not interactive, make sure we turn on the notify bit
so we don't get an unwanted message about the job's termination,
and so delete_job really clears the slot in the jobs table. */
if (posixly_correct == 0 || (interactive_shell == 0 || interactive == 0))
if (posixly_correct == 0 || interactive_shell == 0 || interactive == 0)
notify_and_cleanup (job);
}
+1
View File
@@ -1864,6 +1864,7 @@ rl_parse_and_bind (char *string)
false. */
#define V_SPECIAL 0x1
#define V_DEPRECATED 0x02
static const struct {
const char * const name;
+176 -86
View File
@@ -1,109 +1,199 @@
#!/bin/sh -
#!/bin/sh
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
# mkdep - compute dependencies for the supplied source files
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
# Copyright © 2024 The Free Software Foundation.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# 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.
#
# $FreeBSD: stable/11/usr.bin/mkdep/mkdep.sh 216370 2010-12-11 08:32:16Z joel $
# 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.
#
# @(#)mkdep.sh 8.1 (Berkeley) 6/6/93
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author: Martin D Kealey <martin@kurahaupo.gen.nz>
#
# Modified by Chet Ramey <chet.ramey@case.edu> for inclusion in Bash
#
PATH=/bin:/usr/bin:/usr/ucb:/usr/old/bin
export PATH
append_depfile=false
compiler=cc
depfile=.depend
keep_path=false
keep_output=false
m_flag=-MM
skip_o=false
D=.depend # default dependency file is .depend
append=0
debug=false
while :
do case "$1" in
# -a appends to the depend file
-a)
append=1
shift ;;
usage()
{
echo "$PROG: usage: $PROG [-a] [-c compiler] [-f depend_file] [-k f|p] [-m M|MM] [-p] [--] [cc_flags] file ..." >&2
exit 2
}
# -f allows you to select a makefile name
-f)
D=$2
shift; shift ;;
PROG=${0##*/}
while getopts ac:f:k:m:pD opt "$@"
do
case $opt in
a)
# append to the dependency file (rather than overwriting it)
append_depfile=true ;;
c)
# change compiler
compiler=$OPTARG ;;
f)
# select a dependency file
depfile=$2 ;;
k)
case $OPTARG in
f) # Keep the temporary files on failure
keep_output=true ;;
p)
# keep PATH from environment
keep_path=true ;;
*) usage ; exit 2 ;;
esac ;;
m)
case $OPTARG in
M) m_flag=-M ;;
MM) m_flag=-MM ;;
*) usage ; exit 2 ;;
esac;;
p)
# produce “program: program.c”-style dependencies
# (to avoid generating .o files)
skip_o=true ;;
D) debug=true ;;
?)
usage ;;
esac
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
SED='s;\.o ; ;'
shift ;;
*)
break ;;
esac
done
shift $(( $OPTIND - 1 ))
if [ $# = 0 ] ; then
echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...'
exit 1
usage
fi
TMP=/tmp/mkdep$$
"$debug" && set -x
trap 'rm -f $TMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
"$keep_path" || export PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin:$PATH
cc -M $* |
sed "
s; \./; ;g
/\.c:$/d
$SED" |
awk '{
if ($1 != prev) {
if (rec != "")
print rec;
rec = $0;
prev = $1;
}
else {
if (length(rec $2) > 78) {
print rec;
rec = $0;
}
else
rec = rec " " $2
}
output=$depfile.mkdep$$
cleanup()
{
rm -f "$output".*
}
END {
print rec
}' > $TMP
if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
rm -f $TMP
exit 1
if "$keep_output"
then soft_cleanup() { :; }
else soft_cleanup() { cleanup ; }
fi
if [ $append = 1 ]; then
cat $TMP >> $D
rm -f $TMP
else
mv $TMP $D
fi
caught () {
soft_cleanup
trap 2 # SIGINT?
kill -2 $$
}
trap caught 1 2 3 13 15
"$compiler" "$m_flag" "$@" > "$output.1" || {
ex=$?
echo >&2 "mkdep: compilation failed; exit status $ex."
soft_cleanup
exit "$ex"
}
# The pathnames here don't work for every system (e.g., macOS), but the -MM
# option (the default) usually does the right thing
{
if "$append_depfile"
then
cat "$depfile"
fi
if "$skip_o"
then
sed '
s@ \./@ @g
s@ /usr/include[^ ]*@@g
s@ /usr/lib/gcc[^ ]*@@g
s@\.o @ @
:a
/ \\$/ {
N
s/[[:space:]]*\\\n[[:space:]]*/ /
ta
s/\\$//
}
s/ *$//
/^[^ ]*:$/d
:b
/^[^ :][^ :]*:/ {
s@^\([^ :][^ :]*: \)\([^ ][^ ]*\) @\1\2\n\1@
/: \/usr\/include/bd
/: \/usr\/lib/bd
P
:d
D
tb
}
'
else
sed '
s@ \./@ @g;
s@ /usr/include[^ ]*@@g;
s@ /usr/lib/gcc[^ ]*@@g;
:a
/ \\$/ {
N
s/[[:space:]]*\\\n[[:space:]]*/ /
ta
s/\\$//
}
s/ *$//
/^[^ ]*:$/d
:b
/^[^ :][^ :]*:/ {
s@^\([^ :][^ :]*: \)\([^ ][^ ]*\) @\1\2\n\1@
/: \/usr\/include/bd
/: \/usr\/lib/bd
P
:d
D
tb
}
'
fi < "$output.1"
} |
sort -o "$output.2"
mv "$output.2" "$depfile"
cleanup
exit 0
+100
View File
@@ -0,0 +1,100 @@
#!/bin/sh -
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
D=.depend # default dependency file is .depend
append=0
pflag=
while :
do case "$1" in
# -c compiler
-c) MKDEP_CC=$2
shift; shift ;;
# -a appends to the depend file
-a)
append=1
shift ;;
# -f allows you to select a makefile name
-f)
D=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
pflag=p
shift ;;
*)
break ;;
esac
done
case $# in 0)
echo 'usage: mkdep [-ap] [-f file] [flags] file ...' >&2
exit 1;;
esac
TMP=_mkdep$$
trap 'rm -f $TMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
trap 'rm -f $TMP' 0
# For C sources, mkdep must use exactly the same cpp and predefined flags
# as the compiler would. This is easily arranged by letting the compiler
# pick the cpp. mkdep must be told the cpp to use for exceptional cases.
CC=${CC-"cc"}
MKDEP_CC=${MKDEP_CC:-"${CC}"}
MKDEP_CPP=${MKDEP_CPP-"${MKDEP_CC} -E"}
MKDEP_CPP_OPTS=${MKDEP_CPP_OPTS-"-M"};
echo "# $@" > $TMP # store arguments for debugging
if $MKDEP_CPP $MKDEP_CPP_OPTS "$@" >> $TMP; then :
else
echo 'mkdep: compile failed' >&2
exit 1
fi
case x$pflag in
x) case $append in
0) sed -e 's; \./; ;g' < $TMP > $D;;
*) sed -e 's; \./; ;g' < $TMP >> $D;;
esac
;;
*) case $append in
0) sed -e 's;\.o:;:;' -e 's; \./; ;g' < $TMP > $D;;
*) sed -e 's;\.o:;:;' -e 's; \./; ;g' < $TMP >> $D;;
esac
;;
esac
exit $?
+121
View File
@@ -0,0 +1,121 @@
#!/bin/sh -
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: stable/11/usr.bin/mkdep/mkdep.sh 216370 2010-12-11 08:32:16Z joel $
#
# @(#)mkdep.sh 8.1 (Berkeley) 6/6/93
#
PATH=/bin:/usr/bin:/usr/ucb:/usr/old/bin
export PATH
D=.depend # default dependency file is .depend
append=0
while :
do case "$1" in
-c)
MKDEP_CC=$2
shift; shift ;;
-d) SRCDIR=$2
shift; shift ;;
# -a appends to the depend file
-a)
append=1
shift ;;
# -f allows you to select a makefile name
-f)
D=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
SED='s;\.o ; ;'
shift ;;
*)
break ;;
esac
done
if [ $# = 0 ] ; then
echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...'
exit 1
fi
TMP=/tmp/mkdep$$
trap 'rm -f $TMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
CC=${CC:-cc}
: ${MKDEP_CC:=${CC}}
SRCDIR=${SRCDIR:-.}
( cd ${SRCDIR} && ${MKDEP_CC} -M "$@" ) |
sed "
s; \./; ;g
/\.c:$/d
$SED" |
awk '{
if ($1 != prev) {
if (rec != "")
print rec;
rec = $0;
prev = $1;
}
else {
if (length(rec $2) > 78) {
print rec;
rec = $0;
}
else
rec = rec " " $2
}
}
END {
print rec
}' > $TMP
if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
rm -f $TMP
exit 1
fi
if [ $append = 1 ]; then
cat $TMP >> $D
rm -f $TMP
else
mv $TMP $D
fi
exit 0
+3 -3
View File
@@ -139,14 +139,14 @@ abc
def
ghi
ok
./source8.sub: line 36: improbable-filename: No such file or directory
./source8.sub: line 37: improbable-filename: No such file or directory
./source8.sub: line 40: improbable-filename: No such file or directory
./source8.sub: line 41: 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
./source8.sub: line 55: .: 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
+7 -1
View File
@@ -18,9 +18,13 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
: ${TMPDIR:=/var/tmp}
export TDIR=${TMPDIR}/cwd-$$
export SDIR=${TMPDIR}/source-$$
mkdir -p $TDIR || { echo "$TDIR: cannot create" >&2; exit 1; }
mkdir -p $SDIR || { echo "$SDIR: cannot create" >&2; exit 1; }
cd ${TDIR} || { echo "${TDIR}: cannot cd" >&2; exit 1; }
FN=${SDIR}/improbable-filename
cat >$FN << EOF
@@ -30,7 +34,7 @@ cat >cwd-filename <<EOF
echo file in the current directory
EOF
trap 'rm -rf ${SDIR} ; rm -f cwd-filename' 0
trap 'rm -rf ${TDIR} ${SDIR}' 0
# not found in $PATH
. improbable-filename
@@ -60,3 +64,5 @@ ${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
cd $OLDPWD