diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 76ba92e9..51dbb384 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -5267,3 +5267,34 @@ arrayfunc.c for the rhs of the assignment or the second word in the kvpair to be more consistent with how assignment statements behave (e.g., tilde expansion). Fixes issue reported by maroloccio@gmail.com + + 2/7 + --- +parse.y + - discard_until: now returns the last character read. If we get an + EOF while processing a comment, return EOF + - shell_getc: if discard_until returns EOF, return yacc_EOF + +input.h + - bclearerror: new macro, clears the B_ERROR flag in the buffered + stream BP + +input.c + - b_fill_buffer: try making errors `sticky': if the B_ERROR flag is + set for the buffered stream, return EOF immediately. This is similar + to what stdio does + +builtins/fc.def + - fc_builtin: in posix mode, if there are extra arguments supplied to + -s (e.g. pat=rep first last), throw an error + +doc/{bash.1,bashref.texi} + - printf: document new altform for %q/%Q and %ls/%lc + + 2/8 + --- +bashline.c + - alias_expand_line: if alias_expand doesn't change rl_line_buffer, + just return right away without changing rl_point. Inspired by a + report from Addison Brendtro + - history_expand_line: ditto diff --git a/bashline.c b/bashline.c index 75a5ec69..f4665759 100644 --- a/bashline.c +++ b/bashline.c @@ -2741,6 +2741,13 @@ alias_expand_line (int count, int ignore) new_line = alias_expand (rl_line_buffer); + /* If we didn't expand anything, don't change anything. */ + if (new_line && STREQ (new_line, rl_line_buffer)) + { + free (new_line); + return (0); + } + if (new_line) { set_up_new_line (new_line); @@ -2763,6 +2770,13 @@ history_expand_line (int count, int ignore) new_line = history_expand_line_internal (rl_line_buffer); + /* If we didn't expand anything, don't change anything. */ + if (new_line && STREQ (new_line, rl_line_buffer)) + { + free (new_line); + return (0); + } + if (new_line) { set_up_new_line (new_line); diff --git a/builtins/fc.def b/builtins/fc.def index e2b5b8ea..06f0f610 100644 --- a/builtins/fc.def +++ b/builtins/fc.def @@ -280,6 +280,15 @@ fc_builtin (WORD_LIST *list) return (EXECUTION_FAILURE); } + if (posixly_correct && list && list->next) + { + builtin_error (_("too many arguments")); + if (rlist) + FREE_RLIST (); + + return (EXECUTION_FAILURE); + } + if (rlist) { newcom = fc_dosubs (command, rlist); diff --git a/doc/bash.0 b/doc/bash.0 index ee449e76..904ac377 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -5386,21 +5386,26 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS %%bb causes pprriinnttff to expand backslash escape sequences in the corresponding _a_r_g_u_m_e_n_t in the same way as eecchhoo --ee. %%qq causes pprriinnttff to output the corresponding _a_r_g_u_m_e_n_t in a - format that can be reused as shell input. - %%QQ like %%qq, but applies any supplied precision to the _a_r_g_u_- + format that can be reused as shell input. %%qq and %%QQ use + the $$'''' quoting style if any characters in the argument + string require it, and backslash quoting otherwise. If + the format string uses the _p_r_i_n_t_f alternate form, these + two formats quote the argument string using single + quotes. + %%QQ like %%qq, but applies any supplied precision to the _a_r_g_u_- _m_e_n_t before quoting it. %%((_d_a_t_e_f_m_t))TT - causes pprriinnttff to output the date-time string resulting - from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3). + causes pprriinnttff to output the date-time string resulting + from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3). The corresponding _a_r_g_u_m_e_n_t is an integer representing the - number of seconds since the epoch. Two special argument - values may be used: -1 represents the current time, and - -2 represents the time the shell was invoked. If no ar- + number of seconds since the epoch. Two special argument + values may be used: -1 represents the current time, and + -2 represents the time the shell was invoked. If no ar- gument is specified, conversion behaves as if -1 had been - given. This is an exception to the usual pprriinnttff behav- + given. This is an exception to the usual pprriinnttff behav- ior. - The %b, %q, and %T directives all use the field width and preci- + The %b, %q, and %T specifiers all use the field width and preci- sion arguments from the format specification and write that many bytes from (or use that wide a field for) the expanded argument, which usually contains more characters than the original. @@ -5408,6 +5413,11 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS The %n format specifier accepts a corresponding argument that is treated as a shell variable name. + The %s and %c format specifiers accept an l (long) modifier, + which forces them to convert the argument string to a wide-char- + acter string and apply any supplied field width and precision in + terms of characters, not bytes. + Arguments to non-string format specifiers are treated as C con- stants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value diff --git a/doc/bash.1 b/doc/bash.1 index ab6ef428..4efb6765 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -9460,6 +9460,10 @@ in the same way as \fBecho \-e\fP. .B %q causes \fBprintf\fP to output the corresponding \fIargument\fP in a format that can be reused as shell input. +\fB%q\fP and \fB%Q\fP use the \fB$''\fP quoting style if any characters +in the argument string require it, and backslash quoting otherwise. +If the format string uses the \fIprintf\fP alternate form, these two +formats quote the argument string using single quotes. .TP .B %Q like \fB%q\fP, but applies any supplied precision to the \fIargument\fP @@ -9476,7 +9480,7 @@ If no argument is specified, conversion behaves as if \-1 had been given. This is an exception to the usual \fBprintf\fP behavior. .PD .PP -The %b, %q, and %T directives all use the field width and precision +The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that many bytes from (or use that wide a field for) the expanded argument, which usually contains more characters than the original. @@ -9484,6 +9488,10 @@ contains more characters than the original. The %n format specifier accepts a corresponding argument that is treated as a shell variable name. .PP +The %s and %c format specifiers accept an l (long) modifier, which forces +them to convert the argument string to a wide-character string and apply +any supplied field width and precision in terms of characters, not bytes. +.PP Arguments to non-string format specifiers are treated as C constants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value is the ASCII value of diff --git a/doc/bash.info b/doc/bash.info index 02780a5a..fa9f9d70 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -1,12 +1,12 @@ This is bash.info, produced by makeinfo version 6.8 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.2, 27 December 2022). +Bash shell (version 5.2, 7 February 2023). - This is Edition 5.2, last updated 27 December 2022, of 'The GNU Bash + This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.2. - Copyright (C) 1988-2022 Free Software Foundation, Inc. + Copyright (C) 1988-2023 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, @@ -26,10 +26,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.2, 27 December 2022). The Bash home page is +Bash shell (version 5.2, 7 February 2023). The Bash home page is . - This is Edition 5.2, last updated 27 December 2022, of 'The GNU Bash + This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.2. Bash contains features that appear in other popular shells, and some @@ -2832,8 +2832,8 @@ File: bash.info, Node: Command Search and Execution, Next: Command Execution E ---------------------------------- After a command has been split into words, if it results in a simple -command and an optional list of arguments, the following actions are -taken. +command and an optional list of arguments, the shell performs the +following actions. 1. If the command name contains no slashes, the shell attempts to locate it. If there exists a shell function by that name, that @@ -3564,7 +3564,7 @@ standard. children. The return status is zero. 'trap' - trap [-lp] [ACTION] [SIGSPEC ...] + trap [-Plp] [ACTION] [SIGSPEC ...] The ACTION is a command that is read and executed when the shell receives signal SIGSPEC. If ACTION is absent (and there is a @@ -3580,7 +3580,13 @@ standard. displays the trap commands associated with each SIGSPEC, or, if no SIGSPECs are supplied, for all trapped signals, as a set of 'trap' commands that can be reused as shell input to restore the current - signal dispositions. + signal dispositions. The '-P' option behaves similarly, but + displays only the actions associated with each SIGSPEC argument. + '-P' requires at least one SIGSPEC argument. The '-P' or '-p' + options to 'trap' may be used in a subshell environment (e.g., + command substitution) and, as long as they are used before 'trap' + is used to change a signal's handling, will display the state of + its parent's traps. The '-l' option causes 'trap' to print a list of signal names and their corresponding numbers. Each SIGSPEC is either a signal name @@ -4112,7 +4118,13 @@ standard. Bash Builtins::). '%q' Causes 'printf' to output the corresponding ARGUMENT in a - format that can be reused as shell input. + format that can be reused as shell input. '%q' and '%Q'P use + the ANSI-C quoting style (*note ANSI-C Quoting::) if any + characters in the argument string require it, and backslash + quoting otherwise. If the format string uses the 'printf' + ALTERNATE FORM, these two formats quote the argument string + using single quotes. + '%Q' like '%q', but applies any supplied precision to the ARGUMENT before quoting it. @@ -4126,14 +4138,19 @@ standard. conversion behaves as if -1 had been given. This is an exception to the usual 'printf' behavior. - The %b, %q, and %T directives all use the field width and precision - arguments from the format specification and write that many bytes - from (or use that wide a field for) the expanded argument, which - usually contains more characters than the original. + The %b, %q, and %T format specifiers all use the field width and + precision arguments from the format specification and write that + many bytes from (or use that wide a field for) the expanded + argument, which usually contains more characters than the original. The %n format specifier accepts a corresponding argument that is treated as a shell variable name. + The %s and %c format specifiers accept an l (long) modifier, which + forces them to convert the argument string to a wide-character + string and apply any supplied field width and precision in terms of + characters, not bytes. + Arguments to non-string format specifiers are treated as C language constants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value is @@ -4638,9 +4655,9 @@ parameters, or to display the names and values of shell variables. '-x' Print a trace of simple commands, 'for' commands, 'case' commands, 'select' commands, and arithmetic 'for' commands and - their arguments or associated word lists after they are - expanded and before they are executed. The value of the 'PS4' - variable is expanded and the resultant value is printed before + their arguments or associated word lists to standard error + after they are expanded and before they are executed. The + shell prints the expanded value of the 'PS4' variable before the command and its expanded arguments. '-B' @@ -7107,50 +7124,54 @@ startup files. 16. Function names may not be the same as one of the POSIX special builtins. - 17. POSIX special builtins are found before shell functions during + 17. 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 command lookup. - 18. When printing shell function definitions (e.g., by 'type'), Bash + 19. When printing shell function definitions (e.g., by 'type'), Bash does not print the 'function' keyword. - 19. Literal tildes that appear as the first character in elements of + 20. Literal tildes that appear as the first character in elements of the 'PATH' variable are not expanded as described above under *note Tilde Expansion::. - 20. The 'time' reserved word may be used by itself as a command. When + 21. 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. - 21. When parsing and expanding a ${...} expansion that appears within + 22. 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. - 22. The parser does not recognize 'time' as a reserved word if the + 23. The parser does not recognize 'time' as a reserved word if the next token begins with a '-'. - 23. The '!' character does not introduce history expansion within a + 24. The '!' character does not introduce history expansion within a double-quoted string, even if the 'histexpand' option is enabled. - 24. If a POSIX special builtin returns an error status, a + 25. 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. - 25. The 'unset' builtin with the '-v' option specified returns a fatal + 26. 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. - 26. A non-interactive shell exits with an error status if a variable + 27. 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. - 27. A non-interactive shell exits with an error status if a variable + 28. 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, @@ -7158,142 +7179,145 @@ startup files. perform any further processing of the command in which the error occurred"). - 28. A non-interactive shell exits with an error status if the + 29. 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. - 29. Non-interactive shells exit if FILENAME in '.' FILENAME is not + 30. Non-interactive shells exit if FILENAME in '.' FILENAME is not found. - 30. Non-interactive shells exit if a syntax error in an arithmetic + 31. Non-interactive shells exit if a syntax error in an arithmetic expansion results in an invalid expression. - 31. Non-interactive shells exit if a parameter expansion error occurs. + 32. Non-interactive shells exit if a parameter expansion error occurs. - 32. Non-interactive shells exit if there is a syntax error in a script + 33. 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. - 33. While variable indirection is available, it may not be applied to + 34. While variable indirection is available, it may not be applied to the '#' and '?' special parameters. - 34. Expanding the '*' special parameter in a pattern context where the + 35. Expanding the '*' special parameter in a pattern context where the expansion is double-quoted does not treat the '$*' as if it were double-quoted. - 35. Assignment statements preceding POSIX special builtins persist in + 36. Assignment statements preceding POSIX special builtins persist in the shell environment after the builtin completes. - 36. The 'command' builtin does not prevent builtins that take + 37. 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'. - 37. The 'bg' builtin uses the required format to describe each job + 38. 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. - 38. The output of 'kill -l' prints all the signal names on a single + 39. The output of 'kill -l' prints all the signal names on a single line, separated by spaces, without the 'SIG' prefix. - 39. The 'kill' builtin does not accept signal names with a 'SIG' + 40. The 'kill' builtin does not accept signal names with a 'SIG' prefix. - 40. The 'export' and 'readonly' builtin commands display their output + 41. The 'export' and 'readonly' builtin commands display their output in the format required by POSIX. - 41. The 'trap' builtin displays signal names without the leading + 42. The 'trap' builtin displays signal names without the leading 'SIG'. - 42. The 'trap' builtin doesn't check the first argument for a possible + 43. 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. - 43. 'trap -p' without arguments displays signals whose dispositions + 44. '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. - 44. The '.' and 'source' builtins do not search the current directory + 45. The '.' and 'source' builtins do not search the current directory for the filename argument if it is not found by searching 'PATH'. - 45. Enabling POSIX mode has the effect of setting the + 46. 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. - 46. Enabling POSIX mode has the effect of setting the 'shift_verbose' + 47. 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. - 47. When the 'alias' builtin displays alias definitions, it does not + 48. When the 'alias' builtin displays alias definitions, it does not display them with a leading 'alias ' unless the '-p' option is supplied. - 48. When the 'set' builtin is invoked without options, it does not + 49. When the 'set' builtin is invoked without options, it does not display shell function names and definitions. - 49. When the 'set' builtin is invoked without options, it displays + 50. 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. - 50. When the 'cd' builtin is invoked in logical mode, and the pathname + 51. 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. - 51. When the 'cd' builtin cannot change a directory because the length + 52. When the 'cd' builtin cannot change a directory because the length of the pathname constructed from '$PWD' and the directory name supplied as an argument exceeds 'PATH_MAX' when all symbolic links are expanded, 'cd' will fail instead of attempting to use only the supplied directory name. - 52. The 'pwd' builtin verifies that the value it prints is the same as + 53. 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. - 53. When listing the history, the 'fc' builtin does not include an + 54. When listing the history, the 'fc' builtin does not include an indication of whether or not a history entry has been modified. - 54. The default editor used by 'fc' is 'ed'. + 55. The default editor used by 'fc' is 'ed'. - 55. The 'type' and 'command' builtins will not report a non-executable + 56. If there are too many arguments supplied to 'fc -s', 'fc' prints + an error message and returns failure. + + 57. 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'. - 56. The 'vi' editing mode will invoke the 'vi' editor directly when + 58. The 'vi' editing mode will invoke the 'vi' editor directly when the 'v' command is run, instead of checking '$VISUAL' and '$EDITOR'. - 57. When the 'xpg_echo' option is enabled, Bash does not attempt to + 59. 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. - 58. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' + 60. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' and '-f' options. - 59. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not + 61. 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. - 60. The 'read' builtin may be interrupted by a signal for which a trap + 62. 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. - 61. The 'printf' builtin uses 'double' (via 'strtod') to convert + 63. 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. - 62. Bash removes an exited background process's status from the list + 64. Bash removes an exited background process's status from the list of such statuses after the 'wait' builtin is used to obtain it. - 63. A double quote character ('"') is treated specially when it + 65. 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 @@ -11875,8 +11899,8 @@ D.1 Index of Shell Builtin Commands (line 69) * pwd: Bourne Shell Builtins. (line 212) -* read: Bash Builtins. (line 492) -* readarray: Bash Builtins. (line 589) +* read: Bash Builtins. (line 503) +* readarray: Bash Builtins. (line 600) * readonly: Bourne Shell Builtins. (line 222) * return: Bourne Shell Builtins. @@ -11885,7 +11909,7 @@ D.1 Index of Shell Builtin Commands * shift: Bourne Shell Builtins. (line 262) * shopt: The Shopt Builtin. (line 9) -* source: Bash Builtins. (line 598) +* source: Bash Builtins. (line 609) * suspend: Job Control Builtins. (line 116) * test: Bourne Shell Builtins. @@ -11894,14 +11918,14 @@ D.1 Index of Shell Builtin Commands (line 360) * trap: Bourne Shell Builtins. (line 366) -* type: Bash Builtins. (line 603) -* typeset: Bash Builtins. (line 641) -* ulimit: Bash Builtins. (line 647) +* type: Bash Builtins. (line 614) +* typeset: Bash Builtins. (line 652) +* ulimit: Bash Builtins. (line 658) * umask: Bourne Shell Builtins. - (line 422) -* unalias: Bash Builtins. (line 753) + (line 428) +* unalias: Bash Builtins. (line 764) * unset: Bourne Shell Builtins. - (line 440) + (line 446) * wait: Job Control Builtins. (line 76) @@ -12565,138 +12589,138 @@ D.5 Concept Index  Tag Table: -Node: Top894 -Node: Introduction2811 -Node: What is Bash?3024 -Node: What is a shell?4135 -Node: Definitions6670 -Node: Basic Shell Features9618 -Node: Shell Syntax10834 -Node: Shell Operation11857 -Node: Quoting13147 -Node: Escape Character14448 -Node: Single Quotes14930 -Node: Double Quotes15275 -Node: ANSI-C Quoting16550 -Node: Locale Translation17857 -Node: Creating Internationalized Scripts19165 -Node: Comments23279 -Node: Shell Commands23894 -Node: Reserved Words24829 -Node: Simple Commands25582 -Node: Pipelines26233 -Node: Lists29229 -Node: Compound Commands31021 -Node: Looping Constructs32030 -Node: Conditional Constructs34522 -Node: Command Grouping49007 -Node: Coprocesses50482 -Node: GNU Parallel53142 -Node: Shell Functions54056 -Node: Shell Parameters61938 -Node: Positional Parameters66323 -Node: Special Parameters67222 -Node: Shell Expansions70433 -Node: Brace Expansion72557 -Node: Tilde Expansion75288 -Node: Shell Parameter Expansion77906 -Node: Command Substitution96305 -Node: Arithmetic Expansion97657 -Node: Process Substitution98622 -Node: Word Splitting99739 -Node: Filename Expansion101680 -Node: Pattern Matching104426 -Node: Quote Removal109425 -Node: Redirections109717 -Node: Executing Commands119374 -Node: Simple Command Expansion120041 -Node: Command Search and Execution122148 -Node: Command Execution Environment124523 -Node: Environment127555 -Node: Exit Status129215 -Node: Signals130996 -Node: Shell Scripts134442 -Node: Shell Builtin Commands137466 -Node: Bourne Shell Builtins139501 -Node: Bash Builtins161283 -Node: Modifying Shell Behavior192671 -Node: The Set Builtin193013 -Node: The Shopt Builtin203611 -Node: Special Builtins219520 -Node: Shell Variables220496 -Node: Bourne Shell Variables220930 -Node: Bash Variables223031 -Node: Bash Features255843 -Node: Invoking Bash256853 -Node: Bash Startup Files262863 -Node: Interactive Shells267991 -Node: What is an Interactive Shell?268399 -Node: Is this Shell Interactive?269045 -Node: Interactive Shell Behavior269857 -Node: Bash Conditional Expressions273483 -Node: Shell Arithmetic278122 -Node: Aliases281063 -Node: Arrays283673 -Node: The Directory Stack290061 -Node: Directory Stack Builtins290842 -Node: Controlling the Prompt295099 -Node: The Restricted Shell298061 -Node: Bash POSIX Mode300668 -Node: Shell Compatibility Mode313227 -Node: Job Control321791 -Node: Job Control Basics322248 -Node: Job Control Builtins327247 -Node: Job Control Variables333039 -Node: Command Line Editing334192 -Node: Introduction and Notation335860 -Node: Readline Interaction337480 -Node: Readline Bare Essentials338668 -Node: Readline Movement Commands340454 -Node: Readline Killing Commands341411 -Node: Readline Arguments343329 -Node: Searching344370 -Node: Readline Init File346553 -Node: Readline Init File Syntax347811 -Node: Conditional Init Constructs371394 -Node: Sample Init File375587 -Node: Bindable Readline Commands378708 -Node: Commands For Moving379909 -Node: Commands For History381957 -Node: Commands For Text386948 -Node: Commands For Killing390594 -Node: Numeric Arguments393624 -Node: Commands For Completion394760 -Node: Keyboard Macros398948 -Node: Miscellaneous Commands399633 -Node: Readline vi Mode405575 -Node: Programmable Completion406479 -Node: Programmable Completion Builtins414256 -Node: A Programmable Completion Example425005 -Node: Using History Interactively430250 -Node: Bash History Facilities430931 -Node: Bash History Builtins433933 -Node: History Interaction438954 -Node: Event Designators442571 -Node: Word Designators443922 -Node: Modifiers445679 -Node: Installing Bash447484 -Node: Basic Installation448618 -Node: Compilers and Options452337 -Node: Compiling For Multiple Architectures453075 -Node: Installation Names454764 -Node: Specifying the System Type456870 -Node: Sharing Defaults457584 -Node: Operation Controls458254 -Node: Optional Features459209 -Node: Reporting Bugs470425 -Node: Major Differences From The Bourne Shell471766 -Node: GNU Free Documentation License488612 -Node: Indexes513786 -Node: Builtin Index514237 -Node: Reserved Word Index521061 -Node: Variable Index523506 -Node: Function Index540277 -Node: Concept Index554058 +Node: Top892 +Node: Introduction2807 +Node: What is Bash?3020 +Node: What is a shell?4131 +Node: Definitions6666 +Node: Basic Shell Features9614 +Node: Shell Syntax10830 +Node: Shell Operation11853 +Node: Quoting13143 +Node: Escape Character14444 +Node: Single Quotes14926 +Node: Double Quotes15271 +Node: ANSI-C Quoting16546 +Node: Locale Translation17853 +Node: Creating Internationalized Scripts19161 +Node: Comments23275 +Node: Shell Commands23890 +Node: Reserved Words24825 +Node: Simple Commands25578 +Node: Pipelines26229 +Node: Lists29225 +Node: Compound Commands31017 +Node: Looping Constructs32026 +Node: Conditional Constructs34518 +Node: Command Grouping49003 +Node: Coprocesses50478 +Node: GNU Parallel53138 +Node: Shell Functions54052 +Node: Shell Parameters61934 +Node: Positional Parameters66319 +Node: Special Parameters67218 +Node: Shell Expansions70429 +Node: Brace Expansion72553 +Node: Tilde Expansion75284 +Node: Shell Parameter Expansion77902 +Node: Command Substitution96301 +Node: Arithmetic Expansion97653 +Node: Process Substitution98618 +Node: Word Splitting99735 +Node: Filename Expansion101676 +Node: Pattern Matching104422 +Node: Quote Removal109421 +Node: Redirections109713 +Node: Executing Commands119370 +Node: Simple Command Expansion120037 +Node: Command Search and Execution122144 +Node: Command Execution Environment124528 +Node: Environment127560 +Node: Exit Status129220 +Node: Signals131001 +Node: Shell Scripts134447 +Node: Shell Builtin Commands137471 +Node: Bourne Shell Builtins139506 +Node: Bash Builtins161701 +Node: Modifying Shell Behavior193666 +Node: The Set Builtin194008 +Node: The Shopt Builtin204603 +Node: Special Builtins220512 +Node: Shell Variables221488 +Node: Bourne Shell Variables221922 +Node: Bash Variables224023 +Node: Bash Features256835 +Node: Invoking Bash257845 +Node: Bash Startup Files263855 +Node: Interactive Shells268983 +Node: What is an Interactive Shell?269391 +Node: Is this Shell Interactive?270037 +Node: Interactive Shell Behavior270849 +Node: Bash Conditional Expressions274475 +Node: Shell Arithmetic279114 +Node: Aliases282055 +Node: Arrays284665 +Node: The Directory Stack291053 +Node: Directory Stack Builtins291834 +Node: Controlling the Prompt296091 +Node: The Restricted Shell299053 +Node: Bash POSIX Mode301660 +Node: Shell Compatibility Mode314523 +Node: Job Control323087 +Node: Job Control Basics323544 +Node: Job Control Builtins328543 +Node: Job Control Variables334335 +Node: Command Line Editing335488 +Node: Introduction and Notation337156 +Node: Readline Interaction338776 +Node: Readline Bare Essentials339964 +Node: Readline Movement Commands341750 +Node: Readline Killing Commands342707 +Node: Readline Arguments344625 +Node: Searching345666 +Node: Readline Init File347849 +Node: Readline Init File Syntax349107 +Node: Conditional Init Constructs372690 +Node: Sample Init File376883 +Node: Bindable Readline Commands380004 +Node: Commands For Moving381205 +Node: Commands For History383253 +Node: Commands For Text388244 +Node: Commands For Killing391890 +Node: Numeric Arguments394920 +Node: Commands For Completion396056 +Node: Keyboard Macros400244 +Node: Miscellaneous Commands400929 +Node: Readline vi Mode406871 +Node: Programmable Completion407775 +Node: Programmable Completion Builtins415552 +Node: A Programmable Completion Example426301 +Node: Using History Interactively431546 +Node: Bash History Facilities432227 +Node: Bash History Builtins435229 +Node: History Interaction440250 +Node: Event Designators443867 +Node: Word Designators445218 +Node: Modifiers446975 +Node: Installing Bash448780 +Node: Basic Installation449914 +Node: Compilers and Options453633 +Node: Compiling For Multiple Architectures454371 +Node: Installation Names456060 +Node: Specifying the System Type458166 +Node: Sharing Defaults458880 +Node: Operation Controls459550 +Node: Optional Features460505 +Node: Reporting Bugs471721 +Node: Major Differences From The Bourne Shell473062 +Node: GNU Free Documentation License489908 +Node: Indexes515082 +Node: Builtin Index515533 +Node: Reserved Word Index522357 +Node: Variable Index524802 +Node: Function Index541573 +Node: Concept Index555354  End Tag Table diff --git a/doc/bashref.info b/doc/bashref.info index a0877b73..084e46fb 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.2, 27 January 2023). +Bash shell (version 5.2, 7 February 2023). - This is Edition 5.2, last updated 27 January 2023, of 'The GNU Bash + This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.2. Copyright (C) 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 -Bash shell (version 5.2, 27 January 2023). The Bash home page is +Bash shell (version 5.2, 7 February 2023). The Bash home page is . - This is Edition 5.2, last updated 27 January 2023, of 'The GNU Bash + This is Edition 5.2, last updated 7 February 2023, of 'The GNU Bash Reference Manual', for 'Bash', Version 5.2. Bash contains features that appear in other popular shells, and some @@ -4119,7 +4119,13 @@ standard. Bash Builtins::). '%q' Causes 'printf' to output the corresponding ARGUMENT in a - format that can be reused as shell input. + format that can be reused as shell input. '%q' and '%Q'P use + the ANSI-C quoting style (*note ANSI-C Quoting::) if any + characters in the argument string require it, and backslash + quoting otherwise. If the format string uses the 'printf' + ALTERNATE FORM, these two formats quote the argument string + using single quotes. + '%Q' like '%q', but applies any supplied precision to the ARGUMENT before quoting it. @@ -4133,14 +4139,19 @@ standard. conversion behaves as if -1 had been given. This is an exception to the usual 'printf' behavior. - The %b, %q, and %T directives all use the field width and precision - arguments from the format specification and write that many bytes - from (or use that wide a field for) the expanded argument, which - usually contains more characters than the original. + The %b, %q, and %T format specifiers all use the field width and + precision arguments from the format specification and write that + many bytes from (or use that wide a field for) the expanded + argument, which usually contains more characters than the original. The %n format specifier accepts a corresponding argument that is treated as a shell variable name. + The %s and %c format specifiers accept an l (long) modifier, which + forces them to convert the argument string to a wide-character + string and apply any supplied field width and precision in terms of + characters, not bytes. + Arguments to non-string format specifiers are treated as C language constants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value is @@ -7114,50 +7125,54 @@ startup files. 16. Function names may not be the same as one of the POSIX special builtins. - 17. POSIX special builtins are found before shell functions during + 17. 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 command lookup. - 18. When printing shell function definitions (e.g., by 'type'), Bash + 19. When printing shell function definitions (e.g., by 'type'), Bash does not print the 'function' keyword. - 19. Literal tildes that appear as the first character in elements of + 20. Literal tildes that appear as the first character in elements of the 'PATH' variable are not expanded as described above under *note Tilde Expansion::. - 20. The 'time' reserved word may be used by itself as a command. When + 21. 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. - 21. When parsing and expanding a ${...} expansion that appears within + 22. 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. - 22. The parser does not recognize 'time' as a reserved word if the + 23. The parser does not recognize 'time' as a reserved word if the next token begins with a '-'. - 23. The '!' character does not introduce history expansion within a + 24. The '!' character does not introduce history expansion within a double-quoted string, even if the 'histexpand' option is enabled. - 24. If a POSIX special builtin returns an error status, a + 25. 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. - 25. The 'unset' builtin with the '-v' option specified returns a fatal + 26. 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. - 26. A non-interactive shell exits with an error status if a variable + 27. 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. - 27. A non-interactive shell exits with an error status if a variable + 28. 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, @@ -7165,142 +7180,145 @@ startup files. perform any further processing of the command in which the error occurred"). - 28. A non-interactive shell exits with an error status if the + 29. 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. - 29. Non-interactive shells exit if FILENAME in '.' FILENAME is not + 30. Non-interactive shells exit if FILENAME in '.' FILENAME is not found. - 30. Non-interactive shells exit if a syntax error in an arithmetic + 31. Non-interactive shells exit if a syntax error in an arithmetic expansion results in an invalid expression. - 31. Non-interactive shells exit if a parameter expansion error occurs. + 32. Non-interactive shells exit if a parameter expansion error occurs. - 32. Non-interactive shells exit if there is a syntax error in a script + 33. 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. - 33. While variable indirection is available, it may not be applied to + 34. While variable indirection is available, it may not be applied to the '#' and '?' special parameters. - 34. Expanding the '*' special parameter in a pattern context where the + 35. Expanding the '*' special parameter in a pattern context where the expansion is double-quoted does not treat the '$*' as if it were double-quoted. - 35. Assignment statements preceding POSIX special builtins persist in + 36. Assignment statements preceding POSIX special builtins persist in the shell environment after the builtin completes. - 36. The 'command' builtin does not prevent builtins that take + 37. 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'. - 37. The 'bg' builtin uses the required format to describe each job + 38. 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. - 38. The output of 'kill -l' prints all the signal names on a single + 39. The output of 'kill -l' prints all the signal names on a single line, separated by spaces, without the 'SIG' prefix. - 39. The 'kill' builtin does not accept signal names with a 'SIG' + 40. The 'kill' builtin does not accept signal names with a 'SIG' prefix. - 40. The 'export' and 'readonly' builtin commands display their output + 41. The 'export' and 'readonly' builtin commands display their output in the format required by POSIX. - 41. The 'trap' builtin displays signal names without the leading + 42. The 'trap' builtin displays signal names without the leading 'SIG'. - 42. The 'trap' builtin doesn't check the first argument for a possible + 43. 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. - 43. 'trap -p' without arguments displays signals whose dispositions + 44. '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. - 44. The '.' and 'source' builtins do not search the current directory + 45. The '.' and 'source' builtins do not search the current directory for the filename argument if it is not found by searching 'PATH'. - 45. Enabling POSIX mode has the effect of setting the + 46. 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. - 46. Enabling POSIX mode has the effect of setting the 'shift_verbose' + 47. 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. - 47. When the 'alias' builtin displays alias definitions, it does not + 48. When the 'alias' builtin displays alias definitions, it does not display them with a leading 'alias ' unless the '-p' option is supplied. - 48. When the 'set' builtin is invoked without options, it does not + 49. When the 'set' builtin is invoked without options, it does not display shell function names and definitions. - 49. When the 'set' builtin is invoked without options, it displays + 50. 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. - 50. When the 'cd' builtin is invoked in logical mode, and the pathname + 51. 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. - 51. When the 'cd' builtin cannot change a directory because the length + 52. When the 'cd' builtin cannot change a directory because the length of the pathname constructed from '$PWD' and the directory name supplied as an argument exceeds 'PATH_MAX' when all symbolic links are expanded, 'cd' will fail instead of attempting to use only the supplied directory name. - 52. The 'pwd' builtin verifies that the value it prints is the same as + 53. 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. - 53. When listing the history, the 'fc' builtin does not include an + 54. When listing the history, the 'fc' builtin does not include an indication of whether or not a history entry has been modified. - 54. The default editor used by 'fc' is 'ed'. + 55. The default editor used by 'fc' is 'ed'. - 55. The 'type' and 'command' builtins will not report a non-executable + 56. If there are too many arguments supplied to 'fc -s', 'fc' prints + an error message and returns failure. + + 57. 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'. - 56. The 'vi' editing mode will invoke the 'vi' editor directly when + 58. The 'vi' editing mode will invoke the 'vi' editor directly when the 'v' command is run, instead of checking '$VISUAL' and '$EDITOR'. - 57. When the 'xpg_echo' option is enabled, Bash does not attempt to + 59. 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. - 58. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' + 60. The 'ulimit' builtin uses a block size of 512 bytes for the '-c' and '-f' options. - 59. The arrival of 'SIGCHLD' when a trap is set on 'SIGCHLD' does not + 61. 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. - 60. The 'read' builtin may be interrupted by a signal for which a trap + 62. 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. - 61. The 'printf' builtin uses 'double' (via 'strtod') to convert + 63. 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. - 62. Bash removes an exited background process's status from the list + 64. Bash removes an exited background process's status from the list of such statuses after the 'wait' builtin is used to obtain it. - 63. A double quote character ('"') is treated specially when it + 65. 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 @@ -11882,8 +11900,8 @@ D.1 Index of Shell Builtin Commands (line 69) * pwd: Bourne Shell Builtins. (line 212) -* read: Bash Builtins. (line 492) -* readarray: Bash Builtins. (line 589) +* read: Bash Builtins. (line 503) +* readarray: Bash Builtins. (line 600) * readonly: Bourne Shell Builtins. (line 222) * return: Bourne Shell Builtins. @@ -11892,7 +11910,7 @@ D.1 Index of Shell Builtin Commands * shift: Bourne Shell Builtins. (line 262) * shopt: The Shopt Builtin. (line 9) -* source: Bash Builtins. (line 598) +* source: Bash Builtins. (line 609) * suspend: Job Control Builtins. (line 116) * test: Bourne Shell Builtins. @@ -11901,12 +11919,12 @@ D.1 Index of Shell Builtin Commands (line 360) * trap: Bourne Shell Builtins. (line 366) -* type: Bash Builtins. (line 603) -* typeset: Bash Builtins. (line 641) -* ulimit: Bash Builtins. (line 647) +* type: Bash Builtins. (line 614) +* typeset: Bash Builtins. (line 652) +* ulimit: Bash Builtins. (line 658) * umask: Bourne Shell Builtins. (line 428) -* unalias: Bash Builtins. (line 753) +* unalias: Bash Builtins. (line 764) * unset: Bourne Shell Builtins. (line 446) * wait: Job Control Builtins. @@ -12626,84 +12644,84 @@ Node: Shell Scripts134600 Node: Shell Builtin Commands137627 Node: Bourne Shell Builtins139665 Node: Bash Builtins161863 -Node: Modifying Shell Behavior193254 -Node: The Set Builtin193599 -Node: The Shopt Builtin204197 -Node: Special Builtins220109 -Node: Shell Variables221088 -Node: Bourne Shell Variables221525 -Node: Bash Variables223629 -Node: Bash Features256444 -Node: Invoking Bash257457 -Node: Bash Startup Files263470 -Node: Interactive Shells268601 -Node: What is an Interactive Shell?269012 -Node: Is this Shell Interactive?269661 -Node: Interactive Shell Behavior270476 -Node: Bash Conditional Expressions274105 -Node: Shell Arithmetic278747 -Node: Aliases281691 -Node: Arrays284304 -Node: The Directory Stack290695 -Node: Directory Stack Builtins291479 -Node: Controlling the Prompt295739 -Node: The Restricted Shell298704 -Node: Bash POSIX Mode301314 -Node: Shell Compatibility Mode313876 -Node: Job Control322443 -Node: Job Control Basics322903 -Node: Job Control Builtins327905 -Node: Job Control Variables333700 -Node: Command Line Editing334856 -Node: Introduction and Notation336527 -Node: Readline Interaction338150 -Node: Readline Bare Essentials339341 -Node: Readline Movement Commands341130 -Node: Readline Killing Commands342090 -Node: Readline Arguments344011 -Node: Searching345055 -Node: Readline Init File347241 -Node: Readline Init File Syntax348502 -Node: Conditional Init Constructs372088 -Node: Sample Init File376284 -Node: Bindable Readline Commands379408 -Node: Commands For Moving380612 -Node: Commands For History382663 -Node: Commands For Text387657 -Node: Commands For Killing391306 -Node: Numeric Arguments394339 -Node: Commands For Completion395478 -Node: Keyboard Macros399669 -Node: Miscellaneous Commands400357 -Node: Readline vi Mode406302 -Node: Programmable Completion407209 -Node: Programmable Completion Builtins414989 -Node: A Programmable Completion Example425741 -Node: Using History Interactively430989 -Node: Bash History Facilities431673 -Node: Bash History Builtins434678 -Node: History Interaction439702 -Node: Event Designators443322 -Node: Word Designators444676 -Node: Modifiers446436 -Node: Installing Bash448244 -Node: Basic Installation449381 -Node: Compilers and Options453103 -Node: Compiling For Multiple Architectures453844 -Node: Installation Names455536 -Node: Specifying the System Type457645 -Node: Sharing Defaults458362 -Node: Operation Controls459035 -Node: Optional Features459993 -Node: Reporting Bugs471212 -Node: Major Differences From The Bourne Shell472556 -Node: GNU Free Documentation License489405 -Node: Indexes514582 -Node: Builtin Index515036 -Node: Reserved Word Index521863 -Node: Variable Index524311 -Node: Function Index541085 -Node: Concept Index554869 +Node: Modifying Shell Behavior193831 +Node: The Set Builtin194176 +Node: The Shopt Builtin204774 +Node: Special Builtins220686 +Node: Shell Variables221665 +Node: Bourne Shell Variables222102 +Node: Bash Variables224206 +Node: Bash Features257021 +Node: Invoking Bash258034 +Node: Bash Startup Files264047 +Node: Interactive Shells269178 +Node: What is an Interactive Shell?269589 +Node: Is this Shell Interactive?270238 +Node: Interactive Shell Behavior271053 +Node: Bash Conditional Expressions274682 +Node: Shell Arithmetic279324 +Node: Aliases282268 +Node: Arrays284881 +Node: The Directory Stack291272 +Node: Directory Stack Builtins292056 +Node: Controlling the Prompt296316 +Node: The Restricted Shell299281 +Node: Bash POSIX Mode301891 +Node: Shell Compatibility Mode314757 +Node: Job Control323324 +Node: Job Control Basics323784 +Node: Job Control Builtins328786 +Node: Job Control Variables334581 +Node: Command Line Editing335737 +Node: Introduction and Notation337408 +Node: Readline Interaction339031 +Node: Readline Bare Essentials340222 +Node: Readline Movement Commands342011 +Node: Readline Killing Commands342971 +Node: Readline Arguments344892 +Node: Searching345936 +Node: Readline Init File348122 +Node: Readline Init File Syntax349383 +Node: Conditional Init Constructs372969 +Node: Sample Init File377165 +Node: Bindable Readline Commands380289 +Node: Commands For Moving381493 +Node: Commands For History383544 +Node: Commands For Text388538 +Node: Commands For Killing392187 +Node: Numeric Arguments395220 +Node: Commands For Completion396359 +Node: Keyboard Macros400550 +Node: Miscellaneous Commands401238 +Node: Readline vi Mode407183 +Node: Programmable Completion408090 +Node: Programmable Completion Builtins415870 +Node: A Programmable Completion Example426622 +Node: Using History Interactively431870 +Node: Bash History Facilities432554 +Node: Bash History Builtins435559 +Node: History Interaction440583 +Node: Event Designators444203 +Node: Word Designators445557 +Node: Modifiers447317 +Node: Installing Bash449125 +Node: Basic Installation450262 +Node: Compilers and Options453984 +Node: Compiling For Multiple Architectures454725 +Node: Installation Names456417 +Node: Specifying the System Type458526 +Node: Sharing Defaults459243 +Node: Operation Controls459916 +Node: Optional Features460874 +Node: Reporting Bugs472093 +Node: Major Differences From The Bourne Shell473437 +Node: GNU Free Documentation License490286 +Node: Indexes515463 +Node: Builtin Index515917 +Node: Reserved Word Index522744 +Node: Variable Index525192 +Node: Function Index541966 +Node: Concept Index555750  End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index 2eff91ec..5b44ce74 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -4885,6 +4885,12 @@ corresponding @var{argument} in the same way as @code{echo -e} @item %q Causes @code{printf} to output the corresponding @var{argument} in a format that can be reused as shell input. +@code{%q} and @code{%Q}P use the ANSI-C quoting style (@pxref{ANSI-C Quoting}) +if any characters +in the argument string require it, and backslash quoting otherwise. +If the format string uses the @code{printf} @var{alternate form}, these two +formats quote the argument string using single quotes. + @item %Q like @code{%q}, but applies any supplied precision to the @var{argument} before quoting it. @@ -4900,7 +4906,7 @@ This is an exception to the usual @code{printf} behavior. @end table @noindent -The %b, %q, and %T directives all use the field width and precision +The %b, %q, and %T format specifiers all use the field width and precision arguments from the format specification and write that many bytes from (or use that wide a field for) the expanded argument, which usually contains more characters than the original. @@ -4908,6 +4914,10 @@ contains more characters than the original. The %n format specifier accepts a corresponding argument that is treated as a shell variable name. +The %s and %c format specifiers accept an l (long) modifier, which forces +them to convert the argument string to a wide-character string and apply +any supplied field width and precision in terms of characters, not bytes. + Arguments to non-string format specifiers are treated as C language constants, except that a leading plus or minus sign is allowed, and if the leading character is a single or double quote, the value is the ASCII value of @@ -8423,6 +8433,10 @@ indication of whether or not a history entry has been modified. @item The default editor used by @code{fc} is @code{ed}. +@item +If there are too many arguments supplied to @code{fc -s}, @code{fc} prints +an error message and returns failure. + @item The @code{type} and @code{command} builtins will not report a non-executable file as having been found, though the shell will attempt to execute such a diff --git a/doc/builtins.0 b/doc/builtins.0 index d3e230f6..940c93e7 100644 --- a/doc/builtins.0 +++ b/doc/builtins.0 @@ -938,127 +938,138 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS %%bb causes pprriinnttff to expand backslash escape sequences in the corresponding _a_r_g_u_m_e_n_t in the same way as eecchhoo --ee. %%qq causes pprriinnttff to output the corresponding _a_r_g_u_m_e_n_t in a - format that can be reused as shell input. - %%QQ like %%qq, but applies any supplied precision to the _a_r_g_u_- + format that can be reused as shell input. %%qq and %%QQ use + the $$'''' quoting style if any characters in the argument + string require it, and backslash quoting otherwise. If + the format string uses the _p_r_i_n_t_f alternate form, these + two formats quote the argument string using single + quotes. + %%QQ like %%qq, but applies any supplied precision to the _a_r_g_u_- _m_e_n_t before quoting it. %%((_d_a_t_e_f_m_t))TT - causes pprriinnttff to output the date-time string resulting - from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3). + causes pprriinnttff to output the date-time string resulting + from using _d_a_t_e_f_m_t as a format string for _s_t_r_f_t_i_m_e(3). The corresponding _a_r_g_u_m_e_n_t is an integer representing the - number of seconds since the epoch. Two special argument - values may be used: -1 represents the current time, and - -2 represents the time the shell was invoked. If no ar- + number of seconds since the epoch. Two special argument + values may be used: -1 represents the current time, and + -2 represents the time the shell was invoked. If no ar- gument is specified, conversion behaves as if -1 had been - given. This is an exception to the usual pprriinnttff behav- + given. This is an exception to the usual pprriinnttff behav- ior. - The %b, %q, and %T directives all use the field width and preci- - sion arguments from the format specification and write that many - bytes from (or use that wide a field for) the expanded argument, - which usually contains more characters than the original. + The %b, %q, and %T format specifiers all use the field width and + precision arguments from the format specification and write that + many bytes from (or use that wide a field for) the expanded ar- + gument, which usually contains more characters than the origi- + nal. The %n format specifier accepts a corresponding argument that is treated as a shell variable name. - Arguments to non-string format specifiers are treated as C con- + The %s and %c format specifiers accept an l (long) modifier, + which forces them to convert the argument string to a wide-char- + acter string and apply any supplied field width and precision in + terms of characters, not bytes. + + Arguments to non-string format specifiers are treated as C con- stants, except that a leading plus or minus sign is allowed, and - if the leading character is a single or double quote, the value + if the leading character is a single or double quote, the value is the ASCII value of the following character. - The _f_o_r_m_a_t is reused as necessary to consume all of the _a_r_g_u_- + The _f_o_r_m_a_t is reused as necessary to consume all of the _a_r_g_u_- _m_e_n_t_s. If the _f_o_r_m_a_t requires more _a_r_g_u_m_e_n_t_s than are supplied, - the extra format specifications behave as if a zero value or - null string, as appropriate, had been supplied. The return - value is zero on success, non-zero if an invalid option is sup- + the extra format specifications behave as if a zero value or + null string, as appropriate, had been supplied. The return + value is zero on success, non-zero if an invalid option is sup- plied or a write or assignment error occurs. ppuusshhdd [--nn] [+_n] [-_n] ppuusshhdd [--nn] [_d_i_r] - Adds a directory to the top of the directory stack, or rotates - the stack, making the new top of the stack the current working - directory. With no arguments, ppuusshhdd exchanges the top two ele- - ments of the directory stack. Arguments, if supplied, have the + Adds a directory to the top of the directory stack, or rotates + the stack, making the new top of the stack the current working + directory. With no arguments, ppuusshhdd exchanges the top two ele- + ments of the directory stack. Arguments, if supplied, have the following meanings: - --nn Suppresses the normal change of directory when rotating - or adding directories to the stack, so that only the + --nn Suppresses the normal change of directory when rotating + or adding directories to the stack, so that only the stack is manipulated. - ++_n Rotates the stack so that the _nth directory (counting - from the left of the list shown by ddiirrss, starting with + ++_n Rotates the stack so that the _nth directory (counting + from the left of the list shown by ddiirrss, starting with zero) is at the top. - --_n Rotates the stack so that the _nth directory (counting - from the right of the list shown by ddiirrss, starting with + --_n Rotates the stack so that the _nth directory (counting + from the right of the list shown by ddiirrss, starting with zero) is at the top. _d_i_r Adds _d_i_r to the directory stack at the top After the stack has been modified, if the --nn option was not sup- - plied, ppuusshhdd uses the ccdd builtin to change to the directory at + plied, ppuusshhdd uses the ccdd builtin to change to the directory at the top of the stack. If the ccdd fails, ppuusshhdd returns a non-zero value. - Otherwise, if no arguments are supplied, ppuusshhdd returns 0 unless - the directory stack is empty. When rotating the directory - stack, ppuusshhdd returns 0 unless the directory stack is empty or a + Otherwise, if no arguments are supplied, ppuusshhdd returns 0 unless + the directory stack is empty. When rotating the directory + stack, ppuusshhdd returns 0 unless the directory stack is empty or a non-existent directory stack element is specified. - If the ppuusshhdd command is successful, bash runs ddiirrss to show the + If the ppuusshhdd command is successful, bash runs ddiirrss to show the final contents of the directory stack. ppwwdd [--LLPP] - Print the absolute pathname of the current working directory. + Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the --PP option is supplied or the --oo pphhyyssiiccaall option to the sseett builtin command - is enabled. If the --LL option is used, the pathname printed may - contain symbolic links. The return status is 0 unless an error + is enabled. If the --LL option is used, the pathname printed may + contain symbolic links. The return status is 0 unless an error occurs while reading the name of the current directory or an in- valid option is supplied. rreeaadd [--eerrss] [--aa _a_n_a_m_e] [--dd _d_e_l_i_m] [--ii _t_e_x_t] [--nn _n_c_h_a_r_s] [--NN _n_c_h_a_r_s] [--pp _p_r_o_m_p_t] [--tt _t_i_m_e_o_u_t] [--uu _f_d] [_n_a_m_e ...] - One line is read from the standard input, or from the file de- + One line is read from the standard input, or from the file de- scriptor _f_d supplied as an argument to the --uu option, split into - words as described in _b_a_s_h_(_1_) under WWoorrdd SSpplliittttiinngg, and the + words as described in _b_a_s_h_(_1_) under WWoorrdd SSpplliittttiinngg, and the first word is assigned to the first _n_a_m_e, the second word to the second _n_a_m_e, and so on. If there are more words than names, the remaining words and their intervening delimiters are assigned to - the last _n_a_m_e. If there are fewer words read from the input - stream than names, the remaining names are assigned empty val- - ues. The characters in IIFFSS are used to split the line into - words using the same rules the shell uses for expansion (de- + the last _n_a_m_e. If there are fewer words read from the input + stream than names, the remaining names are assigned empty val- + ues. The characters in IIFFSS are used to split the line into + words using the same rules the shell uses for expansion (de- scribed in _b_a_s_h_(_1_) under WWoorrdd SSpplliittttiinngg). The backslash charac- - ter (\\) may be used to remove any special meaning for the next + ter (\\) may be used to remove any special meaning for the next character read and for line continuation. Options, if supplied, have the following meanings: --aa _a_n_a_m_e The words are assigned to sequential indices of the array variable _a_n_a_m_e, starting at 0. _a_n_a_m_e is unset before any - new values are assigned. Other _n_a_m_e arguments are ig- + new values are assigned. Other _n_a_m_e arguments are ig- nored. --dd _d_e_l_i_m The first character of _d_e_l_i_m is used to terminate the in- - put line, rather than newline. If _d_e_l_i_m is the empty - string, rreeaadd will terminate a line when it reads a NUL + put line, rather than newline. If _d_e_l_i_m is the empty + string, rreeaadd will terminate a line when it reads a NUL character. --ee If the standard input is coming from a terminal, rreeaaddlliinnee - (see RREEAADDLLIINNEE in _b_a_s_h_(_1_)) is used to obtain the line. - Readline uses the current (or default, if line editing - was not previously active) editing settings, but uses + (see RREEAADDLLIINNEE in _b_a_s_h_(_1_)) is used to obtain the line. + Readline uses the current (or default, if line editing + was not previously active) editing settings, but uses readline's default filename completion. --ii _t_e_x_t - If rreeaaddlliinnee is being used to read the line, _t_e_x_t is + If rreeaaddlliinnee is being used to read the line, _t_e_x_t is placed into the editing buffer before editing begins. --nn _n_c_h_a_r_s - rreeaadd returns after reading _n_c_h_a_r_s characters rather than + rreeaadd returns after reading _n_c_h_a_r_s characters rather than waiting for a complete line of input, but honors a delim- - iter if fewer than _n_c_h_a_r_s characters are read before the + iter if fewer than _n_c_h_a_r_s characters are read before the delimiter. --NN _n_c_h_a_r_s - rreeaadd returns after reading exactly _n_c_h_a_r_s characters - rather than waiting for a complete line of input, unless - EOF is encountered or rreeaadd times out. Delimiter charac- - ters encountered in the input are not treated specially - and do not cause rreeaadd to return until _n_c_h_a_r_s characters - are read. The result is not split on the characters in - IIFFSS; the intent is that the variable is assigned exactly + rreeaadd returns after reading exactly _n_c_h_a_r_s characters + rather than waiting for a complete line of input, unless + EOF is encountered or rreeaadd times out. Delimiter charac- + ters encountered in the input are not treated specially + and do not cause rreeaadd to return until _n_c_h_a_r_s characters + are read. The result is not split on the characters in + IIFFSS; the intent is that the variable is assigned exactly the characters read (with the exception of backslash; see the --rr option below). --pp _p_r_o_m_p_t @@ -1066,133 +1077,133 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS line, before attempting to read any input. The prompt is displayed only if input is coming from a terminal. --rr Backslash does not act as an escape character. The back- - slash is considered to be part of the line. In particu- - lar, a backslash-newline pair may not then be used as a + slash is considered to be part of the line. In particu- + lar, a backslash-newline pair may not then be used as a line continuation. --ss Silent mode. If input is coming from a terminal, charac- ters are not echoed. --tt _t_i_m_e_o_u_t - Cause rreeaadd to time out and return failure if a complete - line of input (or a specified number of characters) is - not read within _t_i_m_e_o_u_t seconds. _t_i_m_e_o_u_t may be a deci- - mal number with a fractional portion following the deci- - mal point. This option is only effective if rreeaadd is - reading input from a terminal, pipe, or other special - file; it has no effect when reading from regular files. + Cause rreeaadd to time out and return failure if a complete + line of input (or a specified number of characters) is + not read within _t_i_m_e_o_u_t seconds. _t_i_m_e_o_u_t may be a deci- + mal number with a fractional portion following the deci- + mal point. This option is only effective if rreeaadd is + reading input from a terminal, pipe, or other special + file; it has no effect when reading from regular files. If rreeaadd times out, rreeaadd saves any partial input read into - the specified variable _n_a_m_e. If _t_i_m_e_o_u_t is 0, rreeaadd re- - turns immediately, without trying to read any data. The - exit status is 0 if input is available on the specified - file descriptor, or the read will return EOF, non-zero - otherwise. The exit status is greater than 128 if the + the specified variable _n_a_m_e. If _t_i_m_e_o_u_t is 0, rreeaadd re- + turns immediately, without trying to read any data. The + exit status is 0 if input is available on the specified + file descriptor, or the read will return EOF, non-zero + otherwise. The exit status is greater than 128 if the timeout is exceeded. --uu _f_d Read input from file descriptor _f_d. - If no _n_a_m_e_s are supplied, the line read, without the ending de- - limiter but otherwise unmodified, is assigned to the variable - RREEPPLLYY. The exit status is zero, unless end-of-file is encoun- - tered, rreeaadd times out (in which case the status is greater than - 128), a variable assignment error (such as assigning to a read- + If no _n_a_m_e_s are supplied, the line read, without the ending de- + limiter but otherwise unmodified, is assigned to the variable + RREEPPLLYY. The exit status is zero, unless end-of-file is encoun- + tered, rreeaadd times out (in which case the status is greater than + 128), a variable assignment error (such as assigning to a read- only variable) occurs, or an invalid file descriptor is supplied as the argument to --uu. rreeaaddoonnllyy [--aaAAff] [--pp] [_n_a_m_e[=_w_o_r_d] ...] - The given _n_a_m_e_s are marked readonly; the values of these _n_a_m_e_s - may not be changed by subsequent assignment. If the --ff option - is supplied, the functions corresponding to the _n_a_m_e_s are so - marked. The --aa option restricts the variables to indexed ar- - rays; the --AA option restricts the variables to associative ar- + The given _n_a_m_e_s are marked readonly; the values of these _n_a_m_e_s + may not be changed by subsequent assignment. If the --ff option + is supplied, the functions corresponding to the _n_a_m_e_s are so + marked. The --aa option restricts the variables to indexed ar- + rays; the --AA option restricts the variables to associative ar- rays. If both options are supplied, --AA takes precedence. If no - _n_a_m_e arguments are given, or if the --pp option is supplied, a + _n_a_m_e arguments are given, or if the --pp option is supplied, a list of all readonly names is printed. The other options may be - used to restrict the output to a subset of the set of readonly - names. The --pp option causes output to be displayed in a format - that may be reused as input. If a variable name is followed by - =_w_o_r_d, the value of the variable is set to _w_o_r_d. The return - status is 0 unless an invalid option is encountered, one of the + used to restrict the output to a subset of the set of readonly + names. The --pp option causes output to be displayed in a format + that may be reused as input. If a variable name is followed by + =_w_o_r_d, the value of the variable is set to _w_o_r_d. The return + status is 0 unless an invalid option is encountered, one of the _n_a_m_e_s is not a valid shell variable name, or --ff is supplied with a _n_a_m_e that is not a function. rreettuurrnn [_n] - Causes a function to stop executing and return the value speci- - fied by _n to its caller. If _n is omitted, the return status is - that of the last command executed in the function body. If rree-- + Causes a function to stop executing and return the value speci- + fied by _n to its caller. If _n is omitted, the return status is + that of the last command executed in the function body. If rree-- ttuurrnn is executed by a trap handler, the last command used to de- - termine the status is the last command executed before the trap - handler. If rreettuurrnn is executed during a DDEEBBUUGG trap, the last - command used to determine the status is the last command exe- - cuted by the trap handler before rreettuurrnn was invoked. If rreettuurrnn - is used outside a function, but during execution of a script by - the .. (ssoouurrccee) command, it causes the shell to stop executing - that script and return either _n or the exit status of the last - command executed within the script as the exit status of the + termine the status is the last command executed before the trap + handler. If rreettuurrnn is executed during a DDEEBBUUGG trap, the last + command used to determine the status is the last command exe- + cuted by the trap handler before rreettuurrnn was invoked. If rreettuurrnn + is used outside a function, but during execution of a script by + the .. (ssoouurrccee) command, it causes the shell to stop executing + that script and return either _n or the exit status of the last + command executed within the script as the exit status of the script. If _n is supplied, the return value is its least signif- - icant 8 bits. The return status is non-zero if rreettuurrnn is sup- - plied a non-numeric argument, or is used outside a function and - not during execution of a script by .. or ssoouurrccee. Any command + icant 8 bits. The return status is non-zero if rreettuurrnn is sup- + plied a non-numeric argument, or is used outside a function and + not during execution of a script by .. or ssoouurrccee. Any command associated with the RREETTUURRNN trap is executed before execution re- sumes after the function or script. sseett [--aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [--oo _o_p_t_i_o_n_-_n_a_m_e] [----] [--] [_a_r_g ...] sseett [++aabbeeffhhkkmmnnppttuuvvxxBBCCEEHHPPTT] [++oo _o_p_t_i_o_n_-_n_a_m_e] [----] [--] [_a_r_g ...] - Without options, display the name and value of each shell vari- - able in a format that can be reused as input for setting or re- + Without options, display the name and value of each shell vari- + able in a format that can be reused as input for setting or re- setting the currently-set variables. Read-only variables cannot - be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed. The - output is sorted according to the current locale. When options - are specified, they set or unset shell attributes. Any argu- - ments remaining after option processing are treated as values + be reset. In _p_o_s_i_x _m_o_d_e, only shell variables are listed. The + output is sorted according to the current locale. When options + are specified, they set or unset shell attributes. Any argu- + ments remaining after option processing are treated as values for the positional parameters and are assigned, in order, to $$11, - $$22, ...... $$_n. Options, if specified, have the following mean- + $$22, ...... $$_n. Options, if specified, have the following mean- ings: --aa Each variable or function that is created or modified is - given the export attribute and marked for export to the + given the export attribute and marked for export to the environment of subsequent commands. - --bb Report the status of terminated background jobs immedi- + --bb Report the status of terminated background jobs immedi- ately, rather than before the next primary prompt. This is effective only when job control is enabled. - --ee Exit immediately if a _p_i_p_e_l_i_n_e (which may consist of a - single _s_i_m_p_l_e _c_o_m_m_a_n_d), a _l_i_s_t, or a _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d - (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h_(_1_)), exits with a non-zero - status. The shell does not exit if the command that - fails is part of the command list immediately following + --ee Exit immediately if a _p_i_p_e_l_i_n_e (which may consist of a + single _s_i_m_p_l_e _c_o_m_m_a_n_d), a _l_i_s_t, or a _c_o_m_p_o_u_n_d _c_o_m_m_a_n_d + (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h_(_1_)), exits with a non-zero + status. The shell does not exit if the command that + fails is part of the command list immediately following a wwhhiillee or uunnttiill keyword, part of the test following the - iiff or eelliiff reserved words, part of any command executed - in a &&&& or |||| list except the command following the fi- + iiff or eelliiff reserved words, part of any command executed + in a &&&& or |||| list except the command following the fi- nal &&&& or ||||, any command in a pipeline but the last, or - if the command's return value is being inverted with !!. - If a compound command other than a subshell returns a - non-zero status because a command failed while --ee was - being ignored, the shell does not exit. A trap on EERRRR, + if the command's return value is being inverted with !!. + If a compound command other than a subshell returns a + non-zero status because a command failed while --ee was + being ignored, the shell does not exit. A trap on EERRRR, if set, is executed before the shell exits. This option applies to the shell environment and each subshell envi- ronment separately (see CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENNTT in _b_a_s_h_(_1_)), and may cause subshells to exit before execut- ing all the commands in the subshell. - If a compound command or shell function executes in a - context where --ee is being ignored, none of the commands - executed within the compound command or function body - will be affected by the --ee setting, even if --ee is set - and a command returns a failure status. If a compound - command or shell function sets --ee while executing in a - context where --ee is ignored, that setting will not have - any effect until the compound command or the command + If a compound command or shell function executes in a + context where --ee is being ignored, none of the commands + executed within the compound command or function body + will be affected by the --ee setting, even if --ee is set + and a command returns a failure status. If a compound + command or shell function sets --ee while executing in a + context where --ee is ignored, that setting will not have + any effect until the compound command or the command containing the function call completes. --ff Disable pathname expansion. - --hh Remember the location of commands as they are looked up + --hh Remember the location of commands as they are looked up for execution. This is enabled by default. - --kk All arguments in the form of assignment statements are - placed in the environment for a command, not just those + --kk All arguments in the form of assignment statements are + placed in the environment for a command, not just those that precede the command name. - --mm Monitor mode. Job control is enabled. This option is - on by default for interactive shells on systems that - support it (see JJOOBB CCOONNTTRROOLL in _b_a_s_h_(_1_)). All processes - run in a separate process group. When a background job - completes, the shell prints a line containing its exit + --mm Monitor mode. Job control is enabled. This option is + on by default for interactive shells on systems that + support it (see JJOOBB CCOONNTTRROOLL in _b_a_s_h_(_1_)). All processes + run in a separate process group. When a background job + completes, the shell prints a line containing its exit status. --nn Read commands but do not execute them. This may be used - to check a shell script for syntax errors. This is ig- + to check a shell script for syntax errors. This is ig- nored by interactive shells. --oo _o_p_t_i_o_n_-_n_a_m_e The _o_p_t_i_o_n_-_n_a_m_e can be one of the following: @@ -1200,10 +1211,10 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS Same as --aa. bbrraacceeeexxppaanndd Same as --BB. - eemmaaccss Use an emacs-style command line editing inter- + eemmaaccss Use an emacs-style command line editing inter- face. This is enabled by default when the shell is interactive, unless the shell is started with - the ----nnooeeddiittiinngg option. This also affects the + the ----nnooeeddiittiinngg option. This also affects the editing interface used for rreeaadd --ee. eerrrreexxiitt Same as --ee. eerrrrttrraaccee @@ -1213,12 +1224,12 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS hhaasshhaallll Same as --hh. hhiisstteexxppaanndd Same as --HH. - hhiissttoorryy Enable command history, as described in _b_a_s_h_(_1_) - under HHIISSTTOORRYY. This option is on by default in + hhiissttoorryy Enable command history, as described in _b_a_s_h_(_1_) + under HHIISSTTOORRYY. This option is on by default in interactive shells. iiggnnoorreeeeooff - The effect is as if the shell command ``IG- - NOREEOF=10'' had been executed (see SShheellll VVaarrii-- + The effect is as if the shell command ``IG- + NOREEOF=10'' had been executed (see SShheellll VVaarrii-- aabblleess in _b_a_s_h_(_1_)). kkeeyywwoorrdd Same as --kk. mmoonniittoorr Same as --mm. @@ -1233,177 +1244,177 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS pphhyyssiiccaall Same as --PP. ppiippeeffaaiill - If set, the return value of a pipeline is the - value of the last (rightmost) command to exit - with a non-zero status, or zero if all commands - in the pipeline exit successfully. This option + If set, the return value of a pipeline is the + value of the last (rightmost) command to exit + with a non-zero status, or zero if all commands + in the pipeline exit successfully. This option is disabled by default. - ppoossiixx Change the behavior of bbaasshh where the default - operation differs from the POSIX standard to - match the standard (_p_o_s_i_x _m_o_d_e). See SSEEEE AALLSSOO - in _b_a_s_h_(_1_) for a reference to a document that + ppoossiixx Change the behavior of bbaasshh where the default + operation differs from the POSIX standard to + match the standard (_p_o_s_i_x _m_o_d_e). See SSEEEE AALLSSOO + in _b_a_s_h_(_1_) for a reference to a document that details how posix mode affects bash's behavior. pprriivviilleeggeedd Same as --pp. vveerrbboossee Same as --vv. - vvii Use a vi-style command line editing interface. + vvii Use a vi-style command line editing interface. This also affects the editing interface used for rreeaadd --ee. xxttrraaccee Same as --xx. If --oo is supplied with no _o_p_t_i_o_n_-_n_a_m_e, the values of the - current options are printed. If ++oo is supplied with no - _o_p_t_i_o_n_-_n_a_m_e, a series of sseett commands to recreate the - current option settings is displayed on the standard + current options are printed. If ++oo is supplied with no + _o_p_t_i_o_n_-_n_a_m_e, a series of sseett commands to recreate the + current option settings is displayed on the standard output. - --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and - $$BBAASSHH__EENNVV files are not processed, shell functions are - not inherited from the environment, and the SSHHEELLLLOOPPTTSS, - BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they ap- - pear in the environment, are ignored. If the shell is - started with the effective user (group) id not equal to - the real user (group) id, and the --pp option is not sup- + --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and + $$BBAASSHH__EENNVV files are not processed, shell functions are + not inherited from the environment, and the SSHHEELLLLOOPPTTSS, + BBAASSHHOOPPTTSS, CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they ap- + pear in the environment, are ignored. If the shell is + started with the effective user (group) id not equal to + the real user (group) id, and the --pp option is not sup- plied, these actions are taken and the effective user id - is set to the real user id. If the --pp option is sup- - plied at startup, the effective user id is not reset. - Turning this option off causes the effective user and + is set to the real user id. If the --pp option is sup- + plied at startup, the effective user id is not reset. + Turning this option off causes the effective user and group ids to be set to the real user and group ids. --rr Enable restricted shell mode. This option cannot be un- set once it has been set. --tt Exit after reading and executing one command. --uu Treat unset variables and parameters other than the spe- - cial parameters "@" and "*", or array variables sub- - scripted with "@" or "*", as an error when performing - parameter expansion. If expansion is attempted on an - unset variable or parameter, the shell prints an error - message, and, if not interactive, exits with a non-zero + cial parameters "@" and "*", or array variables sub- + scripted with "@" or "*", as an error when performing + parameter expansion. If expansion is attempted on an + unset variable or parameter, the shell prints an error + message, and, if not interactive, exits with a non-zero status. --vv Print shell input lines as they are read. - --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee + --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee command, sseelleecctt command, or arithmetic ffoorr command, dis- - play the expanded value of PPSS44, followed by the command - and its expanded arguments or associated word list, to + play the expanded value of PPSS44, followed by the command + and its expanded arguments or associated word list, to standard error. - --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn + --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn in _b_a_s_h_(_1_)). This is on by default. - --CC If set, bbaasshh does not overwrite an existing file with - the >>, >>&&, and <<>> redirection operators. This may be + --CC If set, bbaasshh does not overwrite an existing file with + the >>, >>&&, and <<>> redirection operators. This may be overridden when creating output files by using the redi- rection operator >>|| instead of >>. --EE If set, any trap on EERRRR is inherited by shell functions, - command substitutions, and commands executed in a sub- - shell environment. The EERRRR trap is normally not inher- + command substitutions, and commands executed in a sub- + shell environment. The EERRRR trap is normally not inher- ited in such cases. --HH Enable !! style history substitution. This option is on by default when the shell is interactive. - --PP If set, the shell does not resolve symbolic links when - executing commands such as ccdd that change the current + --PP If set, the shell does not resolve symbolic links when + executing commands such as ccdd that change the current working directory. It uses the physical directory structure instead. By default, bbaasshh follows the logical - chain of directories when performing commands which + chain of directories when performing commands which change the current directory. - --TT If set, any traps on DDEEBBUUGG and RREETTUURRNN are inherited by + --TT If set, any traps on DDEEBBUUGG and RREETTUURRNN are inherited by shell functions, command substitutions, and commands ex- - ecuted in a subshell environment. The DDEEBBUUGG and RREETTUURRNN + ecuted in a subshell environment. The DDEEBBUUGG and RREETTUURRNN traps are normally not inherited in such cases. - ---- If no arguments follow this option, then the positional + ---- If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parame- - ters are set to the _a_r_gs, even if some of them begin + ters are set to the _a_r_gs, even if some of them begin with a --. - -- Signal the end of options, cause all remaining _a_r_gs to + -- Signal the end of options, cause all remaining _a_r_gs to be assigned to the positional parameters. The --xx and --vv options are turned off. If there are no _a_r_gs, the posi- tional parameters remain unchanged. - The options are off by default unless otherwise noted. Using + - rather than - causes these options to be turned off. The op- + The options are off by default unless otherwise noted. Using + + rather than - causes these options to be turned off. The op- tions can also be specified as arguments to an invocation of the - shell. The current set of options may be found in $$--. The re- - turn status is always true unless an invalid option is encoun- + shell. The current set of options may be found in $$--. The re- + turn status is always true unless an invalid option is encoun- tered. sshhiifftt [_n] - The positional parameters from _n+1 ... are renamed to $$11 ........ - Parameters represented by the numbers $$## down to $$##-_n+1 are un- - set. _n must be a non-negative number less than or equal to $$##. - If _n is 0, no parameters are changed. If _n is not given, it is + The positional parameters from _n+1 ... are renamed to $$11 ........ + Parameters represented by the numbers $$## down to $$##-_n+1 are un- + set. _n must be a non-negative number less than or equal to $$##. + If _n is 0, no parameters are changed. If _n is not given, it is assumed to be 1. If _n is greater than $$##, the positional param- - eters are not changed. The return status is greater than zero + eters are not changed. The return status is greater than zero if _n is greater than $$## or less than zero; otherwise 0. sshhoopptt [--ppqqssuu] [--oo] [_o_p_t_n_a_m_e ...] - Toggle the values of settings controlling optional shell behav- - ior. The settings can be either those listed below, or, if the + Toggle the values of settings controlling optional shell behav- + ior. The settings can be either those listed below, or, if the --oo option is used, those available with the --oo option to the sseett builtin command. With no options, or with the --pp option, a list - of all settable options is displayed, with an indication of + of all settable options is displayed, with an indication of whether or not each is set; if _o_p_t_n_a_m_e_s are supplied, the output - is restricted to those options. The --pp option causes output to - be displayed in a form that may be reused as input. Other op- + is restricted to those options. The --pp option causes output to + be displayed in a form that may be reused as input. Other op- tions have the following meanings: --ss Enable (set) each _o_p_t_n_a_m_e. --uu Disable (unset) each _o_p_t_n_a_m_e. - --qq Suppresses normal output (quiet mode); the return status + --qq Suppresses normal output (quiet mode); the return status indicates whether the _o_p_t_n_a_m_e is set or unset. If multi- - ple _o_p_t_n_a_m_e arguments are given with --qq, the return sta- - tus is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero other- + ple _o_p_t_n_a_m_e arguments are given with --qq, the return sta- + tus is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero other- wise. - --oo Restricts the values of _o_p_t_n_a_m_e to be those defined for + --oo Restricts the values of _o_p_t_n_a_m_e to be those defined for the --oo option to the sseett builtin. - If either --ss or --uu is used with no _o_p_t_n_a_m_e arguments, sshhoopptt - shows only those options which are set or unset, respectively. - Unless otherwise noted, the sshhoopptt options are disabled (unset) + If either --ss or --uu is used with no _o_p_t_n_a_m_e arguments, sshhoopptt + shows only those options which are set or unset, respectively. + Unless otherwise noted, the sshhoopptt options are disabled (unset) by default. - The return status when listing options is zero if all _o_p_t_n_a_m_e_s - are enabled, non-zero otherwise. When setting or unsetting op- - tions, the return status is zero unless an _o_p_t_n_a_m_e is not a + The return status when listing options is zero if all _o_p_t_n_a_m_e_s + are enabled, non-zero otherwise. When setting or unsetting op- + tions, the return status is zero unless an _o_p_t_n_a_m_e is not a valid shell option. The list of sshhoopptt options is: aassssoocc__eexxppaanndd__oonnccee - If set, the shell suppresses multiple evaluation of as- - sociative array subscripts during arithmetic expression - evaluation, while executing builtins that can perform - variable assignments, and while executing builtins that + If set, the shell suppresses multiple evaluation of as- + sociative array subscripts during arithmetic expression + evaluation, while executing builtins that can perform + variable assignments, and while executing builtins that perform array dereferencing. - aauuttooccdd If set, a command name that is the name of a directory - is executed as if it were the argument to the ccdd com- + aauuttooccdd If set, a command name that is the name of a directory + is executed as if it were the argument to the ccdd com- mand. This option is only used by interactive shells. ccddaabbllee__vvaarrss - If set, an argument to the ccdd builtin command that is - not a directory is assumed to be the name of a variable + If set, an argument to the ccdd builtin command that is + not a directory is assumed to be the name of a variable whose value is the directory to change to. ccddssppeellll If set, minor errors in the spelling of a directory com- - ponent in a ccdd command will be corrected. The errors + ponent in a ccdd command will be corrected. The errors checked for are transposed characters, a missing charac- - ter, and one character too many. If a correction is - found, the corrected filename is printed, and the com- - mand proceeds. This option is only used by interactive + ter, and one character too many. If a correction is + found, the corrected filename is printed, and the com- + mand proceeds. This option is only used by interactive shells. cchheecckkhhaasshh If set, bbaasshh checks that a command found in the hash ta- - ble exists before trying to execute it. If a hashed - command no longer exists, a normal path search is per- + ble exists before trying to execute it. If a hashed + command no longer exists, a normal path search is per- formed. cchheecckkjjoobbss If set, bbaasshh lists the status of any stopped and running - jobs before exiting an interactive shell. If any jobs + jobs before exiting an interactive shell. If any jobs are running, this causes the exit to be deferred until a - second exit is attempted without an intervening command - (see JJOOBB CCOONNTTRROOLL in _b_a_s_h_(_1_)). The shell always post- + second exit is attempted without an intervening command + (see JJOOBB CCOONNTTRROOLL in _b_a_s_h_(_1_)). The shell always post- pones exiting if any jobs are stopped. cchheecckkwwiinnssiizzee - If set, bbaasshh checks the window size after each external - (non-builtin) command and, if necessary, updates the - values of LLIINNEESS and CCOOLLUUMMNNSS. This option is enabled by + If set, bbaasshh checks the window size after each external + (non-builtin) command and, if necessary, updates the + values of LLIINNEESS and CCOOLLUUMMNNSS. This option is enabled by default. - ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple- - line command in the same history entry. This allows - easy re-editing of multi-line commands. This option is - enabled by default, but only has an effect if command - history is enabled, as described in _b_a_s_h_(_1_) under HHIISS-- + ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple- + line command in the same history entry. This allows + easy re-editing of multi-line commands. This option is + enabled by default, but only has an effect if command + history is enabled, as described in _b_a_s_h_(_1_) under HHIISS-- TTOORRYY. ccoommppaatt3311 ccoommppaatt3322 @@ -1413,122 +1424,122 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS ccoommppaatt4433 ccoommppaatt4444 ccoommppaatt5500 - These control aspects of the shell's compatibility mode + These control aspects of the shell's compatibility mode (see SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE in _b_a_s_h_(_1_)). ccoommpplleettee__ffuullllqquuoottee - If set, bbaasshh quotes all shell metacharacters in file- - names and directory names when performing completion. + If set, bbaasshh quotes all shell metacharacters in file- + names and directory names when performing completion. If not set, bbaasshh removes metacharacters such as the dol- - lar sign from the set of characters that will be quoted - in completed filenames when these metacharacters appear - in shell variable references in words to be completed. - This means that dollar signs in variable names that ex- - pand to directories will not be quoted; however, any - dollar signs appearing in filenames will not be quoted, - either. This is active only when bash is using back- - slashes to quote completed filenames. This variable is - set by default, which is the default bash behavior in + lar sign from the set of characters that will be quoted + in completed filenames when these metacharacters appear + in shell variable references in words to be completed. + This means that dollar signs in variable names that ex- + pand to directories will not be quoted; however, any + dollar signs appearing in filenames will not be quoted, + either. This is active only when bash is using back- + slashes to quote completed filenames. This variable is + set by default, which is the default bash behavior in versions through 4.2. ddiirreexxppaanndd - If set, bbaasshh replaces directory names with the results - of word expansion when performing filename completion. - This changes the contents of the readline editing buf- - fer. If not set, bbaasshh attempts to preserve what the + If set, bbaasshh replaces directory names with the results + of word expansion when performing filename completion. + This changes the contents of the readline editing buf- + fer. If not set, bbaasshh attempts to preserve what the user typed. ddiirrssppeellll - If set, bbaasshh attempts spelling correction on directory - names during word completion if the directory name ini- + If set, bbaasshh attempts spelling correction on directory + names during word completion if the directory name ini- tially supplied does not exist. - ddoottgglloobb If set, bbaasshh includes filenames beginning with a `.' in - the results of pathname expansion. The filenames ````..'''' - and ````....'''' must always be matched explicitly, even if + ddoottgglloobb If set, bbaasshh includes filenames beginning with a `.' in + the results of pathname expansion. The filenames ````..'''' + and ````....'''' must always be matched explicitly, even if ddoottgglloobb is set. eexxeeccffaaiill If set, a non-interactive shell will not exit if it can- - not execute the file specified as an argument to the - eexxeecc builtin command. An interactive shell does not + not execute the file specified as an argument to the + eexxeecc builtin command. An interactive shell does not exit if eexxeecc fails. eexxppaanndd__aalliiaasseess If set, aliases are expanded as described in _b_a_s_h_(_1_) un- - der AALLIIAASSEESS. This option is enabled by default for in- + der AALLIIAASSEESS. This option is enabled by default for in- teractive shells. eexxttddeebbuugg - If set at shell invocation, or in a shell startup file, + If set at shell invocation, or in a shell startup file, arrange to execute the debugger profile before the shell - starts, identical to the ----ddeebbuuggggeerr option. If set af- - ter invocation, behavior intended for use by debuggers + starts, identical to the ----ddeebbuuggggeerr option. If set af- + ter invocation, behavior intended for use by debuggers is enabled: 11.. The --FF option to the ddeeccllaarree builtin displays the source file name and line number corresponding to each function name supplied as an argument. - 22.. If the command run by the DDEEBBUUGG trap returns a - non-zero value, the next command is skipped and + 22.. If the command run by the DDEEBBUUGG trap returns a + non-zero value, the next command is skipped and not executed. - 33.. If the command run by the DDEEBBUUGG trap returns a - value of 2, and the shell is executing in a sub- - routine (a shell function or a shell script exe- - cuted by the .. or ssoouurrccee builtins), the shell + 33.. If the command run by the DDEEBBUUGG trap returns a + value of 2, and the shell is executing in a sub- + routine (a shell function or a shell script exe- + cuted by the .. or ssoouurrccee builtins), the shell simulates a call to rreettuurrnn. - 44.. BBAASSHH__AARRGGCC and BBAASSHH__AARRGGVV are updated as described + 44.. BBAASSHH__AARRGGCC and BBAASSHH__AARRGGVV are updated as described in their descriptions in _b_a_s_h_(_1_)). - 55.. Function tracing is enabled: command substitu- + 55.. Function tracing is enabled: command substitu- tion, shell functions, and subshells invoked with (( _c_o_m_m_a_n_d )) inherit the DDEEBBUUGG and RREETTUURRNN traps. - 66.. Error tracing is enabled: command substitution, - shell functions, and subshells invoked with (( + 66.. Error tracing is enabled: command substitution, + shell functions, and subshells invoked with (( _c_o_m_m_a_n_d )) inherit the EERRRR trap. eexxttgglloobb If set, the extended pattern matching features described in _b_a_s_h_(_1_) under PPaatthhnnaammee EExxppaannssiioonn are enabled. eexxttqquuoottee - If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed - within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double + If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed + within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double quotes. This option is enabled by default. ffaaiillgglloobb - If set, patterns which fail to match filenames during + If set, patterns which fail to match filenames during pathname expansion result in an expansion error. ffoorrccee__ffiiggnnoorree - If set, the suffixes specified by the FFIIGGNNOORREE shell - variable cause words to be ignored when performing word + If set, the suffixes specified by the FFIIGGNNOORREE shell + variable cause words to be ignored when performing word completion even if the ignored words are the only possi- - ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS in _b_a_s_h_(_1_) for a - description of FFIIGGNNOORREE. This option is enabled by de- + ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS in _b_a_s_h_(_1_) for a + description of FFIIGGNNOORREE. This option is enabled by de- fault. gglloobbaasscciiiirraannggeess - If set, range expressions used in pattern matching - bracket expressions (see PPaatttteerrnn MMaattcchhiinngg in _b_a_s_h_(_1_)) + If set, range expressions used in pattern matching + bracket expressions (see PPaatttteerrnn MMaattcchhiinngg in _b_a_s_h_(_1_)) behave as if in the traditional C locale when performing - comparisons. That is, the current locale's collating - sequence is not taken into account, so bb will not col- - late between AA and BB, and upper-case and lower-case + comparisons. That is, the current locale's collating + sequence is not taken into account, so bb will not col- + late between AA and BB, and upper-case and lower-case ASCII characters will collate together. gglloobbsskkiippddoottss - If set, pathname expansion will never match the file- + If set, pathname expansion will never match the file- names ````..'''' and ````....'''', even if the pattern begins with a ````..''''. This option is enabled by default. gglloobbssttaarr If set, the pattern **** used in a pathname expansion con- - text will match all files and zero or more directories - and subdirectories. If the pattern is followed by a //, + text will match all files and zero or more directories + and subdirectories. If the pattern is followed by a //, only directories and subdirectories match. ggnnuu__eerrrrffmmtt @@ -1536,25 +1547,25 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS GNU error message format. hhiissttaappppeenndd - If set, the history list is appended to the file named + If set, the history list is appended to the file named by the value of the HHIISSTTFFIILLEE variable when the shell ex- its, rather than overwriting the file. hhiissttrreeeeddiitt - If set, and rreeaaddlliinnee is being used, a user is given the + If set, and rreeaaddlliinnee is being used, a user is given the opportunity to re-edit a failed history substitution. hhiissttvveerriiffyy - If set, and rreeaaddlliinnee is being used, the results of his- - tory substitution are not immediately passed to the - shell parser. Instead, the resulting line is loaded + If set, and rreeaaddlliinnee is being used, the results of his- + tory substitution are not immediately passed to the + shell parser. Instead, the resulting line is loaded into the rreeaaddlliinnee editing buffer, allowing further modi- fication. hhoossttccoommpplleettee If set, and rreeaaddlliinnee is being used, bbaasshh will attempt to - perform hostname completion when a word containing a @@ - is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE in + perform hostname completion when a word containing a @@ + is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE in _b_a_s_h_(_1_)). This is enabled by default. hhuuppoonneexxiitt @@ -1562,23 +1573,23 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS active login shell exits. iinnhheerriitt__eerrrreexxiitt - If set, command substitution inherits the value of the - eerrrreexxiitt option, instead of unsetting it in the subshell - environment. This option is enabled when _p_o_s_i_x _m_o_d_e is + If set, command substitution inherits the value of the + eerrrreexxiitt option, instead of unsetting it in the subshell + environment. This option is enabled when _p_o_s_i_x _m_o_d_e is enabled. iinntteerraaccttiivvee__ccoommmmeennttss If set, allow a word beginning with ## to cause that word - and all remaining characters on that line to be ignored + and all remaining characters on that line to be ignored in an interactive shell (see CCOOMMMMEENNTTSS in _b_a_s_h_(_1_)). This option is enabled by default. llaassttppiippee - If set, and job control is not active, the shell runs + If set, and job control is not active, the shell runs the last command of a pipeline not executed in the back- ground in the current shell environment. - lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line + lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible. @@ -1589,125 +1600,125 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS tribute is not inherited. llooccaallvvaarr__uunnsseett - If set, calling uunnsseett on local variables in previous - function scopes marks them so subsequent lookups find - them unset until that function returns. This is identi- - cal to the behavior of unsetting local variables at the + If set, calling uunnsseett on local variables in previous + function scopes marks them so subsequent lookups find + them unset until that function returns. This is identi- + cal to the behavior of unsetting local variables at the current function scope. llooggiinn__sshheellll - The shell sets this option if it is started as a login + The shell sets this option if it is started as a login shell (see IINNVVOOCCAATTIIOONN in _b_a_s_h_(_1_)). The value may not be changed. mmaaiillwwaarrnn - If set, and a file that bbaasshh is checking for mail has - been accessed since the last time it was checked, the - message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis- + If set, and a file that bbaasshh is checking for mail has + been accessed since the last time it was checked, the + message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis- played. nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn - If set, and rreeaaddlliinnee is being used, bbaasshh will not at- - tempt to search the PPAATTHH for possible completions when + If set, and rreeaaddlliinnee is being used, bbaasshh will not at- + tempt to search the PPAATTHH for possible completions when completion is attempted on an empty line. nnooccaasseegglloobb - If set, bbaasshh matches filenames in a case-insensitive + If set, bbaasshh matches filenames in a case-insensitive fashion when performing pathname expansion (see PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h_(_1_)). nnooccaasseemmaattcchh - If set, bbaasshh matches patterns in a case-insensitive + If set, bbaasshh matches patterns in a case-insensitive fashion when performing matching while executing ccaassee or [[[[ conditional commands, when performing pattern substi- - tution word expansions, or when filtering possible com- + tution word expansions, or when filtering possible com- pletions as part of programmable completion. nnooeexxppaanndd__ttrraannssllaattiioonn - If set, bbaasshh encloses the translated results of $"..." - quoting in single quotes instead of double quotes. If + If set, bbaasshh encloses the translated results of $"..." + quoting in single quotes instead of double quotes. If the string is not translated, this has no effect. nnuullllgglloobb - If set, bbaasshh allows patterns which match no files (see - PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h_(_1_)) to expand to a null + If set, bbaasshh allows patterns which match no files (see + PPaatthhnnaammee EExxppaannssiioonn in _b_a_s_h_(_1_)) to expand to a null string, rather than themselves. ppaattssuubb__rreeppllaacceemmeenntt If set, bbaasshh expands occurrences of && in the replacement - string of pattern substitution to the text matched by - the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn in + string of pattern substitution to the text matched by + the pattern, as described under PPaarraammeetteerr EExxppaannssiioonn in _b_a_s_h_(_1_). This option is enabled by default. pprrooggccoommpp If set, the programmable completion facilities (see PPrroo-- - ggrraammmmaabbllee CCoommpplleettiioonn in _b_a_s_h_(_1_)) are enabled. This op- + ggrraammmmaabbllee CCoommpplleettiioonn in _b_a_s_h_(_1_)) are enabled. This op- tion is enabled by default. pprrooggccoommpp__aalliiaass - If set, and programmable completion is enabled, bbaasshh - treats a command name that doesn't have any completions - as a possible alias and attempts alias expansion. If it - has an alias, bbaasshh attempts programmable completion us- + If set, and programmable completion is enabled, bbaasshh + treats a command name that doesn't have any completions + as a possible alias and attempts alias expansion. If it + has an alias, bbaasshh attempts programmable completion us- ing the command word resulting from the expanded alias. pprroommppttvvaarrss If set, prompt strings undergo parameter expansion, com- - mand substitution, arithmetic expansion, and quote re- - moval after being expanded as described in PPRROOMMPPTTIINNGG in + mand substitution, arithmetic expansion, and quote re- + moval after being expanded as described in PPRROOMMPPTTIINNGG in _b_a_s_h_(_1_). This option is enabled by default. rreessttrriicctteedd__sshheellll - The shell sets this option if it is started in re- - stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL in _b_a_s_h_(_1_)). The - value may not be changed. This is not reset when the - startup files are executed, allowing the startup files + The shell sets this option if it is started in re- + stricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL in _b_a_s_h_(_1_)). The + value may not be changed. This is not reset when the + startup files are executed, allowing the startup files to discover whether or not a shell is restricted. sshhiifftt__vveerrbboossee - If set, the sshhiifftt builtin prints an error message when + If set, the sshhiifftt builtin prints an error message when the shift count exceeds the number of positional parame- ters. ssoouurrcceeppaatthh If set, the .. (ssoouurrccee) builtin uses the value of PPAATTHH to - find the directory containing the file supplied as an + find the directory containing the file supplied as an argument. This option is enabled by default. vvaarrrreeddiirr__cclloossee - If set, the shell automatically closes file descriptors + If set, the shell automatically closes file descriptors assigned using the _{_v_a_r_n_a_m_e_} redirection syntax (see RREE-- - DDIIRREECCTTIIOONN in _b_a_s_h_(_1_)) instead of leaving them open when + DDIIRREECCTTIIOONN in _b_a_s_h_(_1_)) instead of leaving them open when the command completes. xxppgg__eecchhoo - If set, the eecchhoo builtin expands backslash-escape se- + If set, the eecchhoo builtin expands backslash-escape se- quences by default. ssuussppeenndd [--ff] - Suspend the execution of this shell until it receives a SSIIGGCCOONNTT - signal. A login shell, or a shell without job control enabled, - cannot be suspended; the --ff option can be used to override this - and force the suspension. The return status is 0 unless the - shell is a login shell or job control is not enabled and --ff is + Suspend the execution of this shell until it receives a SSIIGGCCOONNTT + signal. A login shell, or a shell without job control enabled, + cannot be suspended; the --ff option can be used to override this + and force the suspension. The return status is 0 unless the + shell is a login shell or job control is not enabled and --ff is not supplied. tteesstt _e_x_p_r [[ _e_x_p_r ]] Return a status of 0 (true) or 1 (false) depending on the evalu- ation of the conditional expression _e_x_p_r. Each operator and op- - erand must be a separate argument. Expressions are composed of - the primaries described in _b_a_s_h_(_1_) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- + erand must be a separate argument. Expressions are composed of + the primaries described in _b_a_s_h_(_1_) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- SSIIOONNSS. tteesstt does not accept any options, nor does it accept and ignore an argument of ---- as signifying the end of options. - Expressions may be combined using the following operators, - listed in decreasing order of precedence. The evaluation de- - pends on the number of arguments; see below. Operator prece- + Expressions may be combined using the following operators, + listed in decreasing order of precedence. The evaluation de- + pends on the number of arguments; see below. Operator prece- dence is used when there are five or more arguments. !! _e_x_p_r True if _e_x_p_r is false. (( _e_x_p_r )) - Returns the value of _e_x_p_r. This may be used to override + Returns the value of _e_x_p_r. This may be used to override the normal precedence of operators. _e_x_p_r_1 -aa _e_x_p_r_2 True if both _e_x_p_r_1 and _e_x_p_r_2 are true. @@ -1724,157 +1735,157 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS null. 2 arguments If the first argument is !!, the expression is true if and - only if the second argument is null. If the first argu- - ment is one of the unary conditional operators listed in - _b_a_s_h_(_1_) under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is + only if the second argument is null. If the first argu- + ment is one of the unary conditional operators listed in + _b_a_s_h_(_1_) under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is true if the unary test is true. If the first argument is not a valid unary conditional operator, the expression is false. 3 arguments The following conditions are applied in the order listed. - If the second argument is one of the binary conditional - operators listed in _b_a_s_h_(_1_) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- - SSIIOONNSS, the result of the expression is the result of the - binary test using the first and third arguments as oper- - ands. The --aa and --oo operators are considered binary op- + If the second argument is one of the binary conditional + operators listed in _b_a_s_h_(_1_) under CCOONNDDIITTIIOONNAALL EEXXPPRREESS-- + SSIIOONNSS, the result of the expression is the result of the + binary test using the first and third arguments as oper- + ands. The --aa and --oo operators are considered binary op- erators when there are three arguments. If the first ar- - gument is !!, the value is the negation of the two-argu- - ment test using the second and third arguments. If the + gument is !!, the value is the negation of the two-argu- + ment test using the second and third arguments. If the first argument is exactly (( and the third argument is ex- - actly )), the result is the one-argument test of the sec- + actly )), the result is the one-argument test of the sec- ond argument. Otherwise, the expression is false. 4 arguments The following conditions are applied in the order listed. If the first argument is !!, the result is the negation of - the three-argument expression composed of the remaining - arguments. the two-argument test using the second and - third arguments. If the first argument is exactly (( and - the fourth argument is exactly )), the result is the two- - argument test of the second and third arguments. Other- + the three-argument expression composed of the remaining + arguments. the two-argument test using the second and + third arguments. If the first argument is exactly (( and + the fourth argument is exactly )), the result is the two- + argument test of the second and third arguments. Other- wise, the expression is parsed and evaluated according to precedence using the rules listed above. 5 or more arguments - The expression is parsed and evaluated according to + The expression is parsed and evaluated according to precedence using the rules listed above. - When used with tteesstt or [[, the << and >> operators sort lexico- + When used with tteesstt or [[, the << and >> operators sort lexico- graphically using ASCII ordering. - ttiimmeess Print the accumulated user and system times for the shell and + ttiimmeess Print the accumulated user and system times for the shell and for processes run from the shell. The return status is 0. ttrraapp [--llpp] [[_a_c_t_i_o_n] _s_i_g_s_p_e_c ...] The _a_c_t_i_o_n is a command that is read and executed when the shell receives signal(s) _s_i_g_s_p_e_c. If _a_c_t_i_o_n is absent (and there is a - single _s_i_g_s_p_e_c) or --, each specified signal is reset to its - original disposition (the value it had upon entrance to the - shell). If _a_c_t_i_o_n is the null string the signal specified by - each _s_i_g_s_p_e_c is ignored by the shell and by the commands it in- + single _s_i_g_s_p_e_c) or --, each specified signal is reset to its + original disposition (the value it had upon entrance to the + shell). If _a_c_t_i_o_n is the null string the signal specified by + each _s_i_g_s_p_e_c is ignored by the shell and by the commands it in- vokes. - If no arguments are supplied, ttrraapp displays the actions associ- + If no arguments are supplied, ttrraapp displays the actions associ- ated with each trapped signal as a set of ttrraapp commands that can - be reused as shell input to restore the current signal disposi- - tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp - displays the actions associated with each _s_i_g_s_p_e_c or, if none + be reused as shell input to restore the current signal disposi- + tions. If --pp is given, and _a_c_t_i_o_n is not present, then ttrraapp + displays the actions associated with each _s_i_g_s_p_e_c or, if none are supplied, for all trapped signals, as a set of ttrraapp commands - that can be reused as shell input to restore the current signal - dispositions. The --PP option behaves similarly, but displays - only the actions associated with each _s_i_g_s_p_e_c argument. --PP re- - quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options to - ttrraapp may be used in a subshell environment (e.g., command sub- - stitution) and, as long as they are used before ttrraapp is used to - change a signal's handling, will display the state of its par- + that can be reused as shell input to restore the current signal + dispositions. The --PP option behaves similarly, but displays + only the actions associated with each _s_i_g_s_p_e_c argument. --PP re- + quires at least one _s_i_g_s_p_e_c argument. The --PP or --pp options to + ttrraapp may be used in a subshell environment (e.g., command sub- + stitution) and, as long as they are used before ttrraapp is used to + change a signal's handling, will display the state of its par- ent's traps. - The --ll option causes ttrraapp to print a list of signal names and - their corresponding numbers. Each _s_i_g_s_p_e_c is either a signal - name defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names + The --ll option causes ttrraapp to print a list of signal names and + their corresponding numbers. Each _s_i_g_s_p_e_c is either a signal + name defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are case insensitive and the SSIIGG prefix is optional. - If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_c_t_i_o_n is executed on exit - from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_c_t_i_o_n is + If a _s_i_g_s_p_e_c is EEXXIITT (0) the command _a_c_t_i_o_n is executed on exit + from the shell. If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_c_t_i_o_n is executed before every _s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, - _s_e_l_e_c_t command, (( arithmetic command, [[ conditional command, + _s_e_l_e_c_t command, (( arithmetic command, [[ conditional command, arithmetic _f_o_r command, and before the first command executes in - a shell function (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h_(_1_)). Refer to the - description of the eexxttddeebbuugg option to the sshhoopptt builtin for de- - tails of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN, - the command _a_c_t_i_o_n is executed each time a shell function or a - script executed with the .. or ssoouurrccee builtins finishes execut- + a shell function (see SSHHEELLLL GGRRAAMMMMAARR in _b_a_s_h_(_1_)). Refer to the + description of the eexxttddeebbuugg option to the sshhoopptt builtin for de- + tails of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is RREETTUURRNN, + the command _a_c_t_i_o_n is executed each time a shell function or a + script executed with the .. or ssoouurrccee builtins finishes execut- ing. - If a _s_i_g_s_p_e_c is EERRRR, the command _a_c_t_i_o_n is executed whenever a + If a _s_i_g_s_p_e_c is EERRRR, the command _a_c_t_i_o_n is executed whenever a pipeline (which may consist of a single simple command), a list, or a compound command returns a non-zero exit status, subject to - the following conditions. The EERRRR trap is not executed if the + the following conditions. The EERRRR trap is not executed if the failed command is part of the command list immediately following - a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement, + a wwhhiillee or uunnttiill keyword, part of the test in an _i_f statement, part of a command executed in a &&&& or |||| list except the command - following the final &&&& or ||||, any command in a pipeline but the - last, or if the command's return value is being inverted using + following the final &&&& or ||||, any command in a pipeline but the + last, or if the command's return value is being inverted using !!. These are the same conditions obeyed by the eerrrreexxiitt (--ee) op- tion. When the shell is not interactive, signals ignored upon entry to the shell cannot be trapped or reset. Interactive shells permit trapping signals ignored on entry. Trapped signals that are not - being ignored are reset to their original values in a subshell - or subshell environment when one is created. The return status + being ignored are reset to their original values in a subshell + or subshell environment when one is created. The return status is false if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true. ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...] - With no options, indicate how each _n_a_m_e would be interpreted if + With no options, indicate how each _n_a_m_e would be interpreted if used as a command name. If the --tt option is used, ttyyppee prints a - string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or - _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function, - builtin, or executable disk file, respectively. If the _n_a_m_e is - not found, then nothing is printed, and ttyyppee returns a non-zero - exit status. If the --pp option is used, ttyyppee either returns the - name of the executable file that would be found by searching - $$PPAATTHH if _n_a_m_e were specified as a command name, or nothing if - ``type -t name'' would not return _f_i_l_e. The --PP option forces a - PPAATTHH search for each _n_a_m_e, even if ``type -t name'' would not + string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or + _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function, + builtin, or executable disk file, respectively. If the _n_a_m_e is + not found, then nothing is printed, and ttyyppee returns a non-zero + exit status. If the --pp option is used, ttyyppee either returns the + name of the executable file that would be found by searching + $$PPAATTHH if _n_a_m_e were specified as a command name, or nothing if + ``type -t name'' would not return _f_i_l_e. The --PP option forces a + PPAATTHH search for each _n_a_m_e, even if ``type -t name'' would not return _f_i_l_e. If a command is hashed, --pp and --PP print the hashed - value, which is not necessarily the file that appears first in - PPAATTHH. If the --aa option is used, ttyyppee prints all of the places - that contain a command named _n_a_m_e. This includes aliases, re- - served words, functions, and builtins, but the path search op- + value, which is not necessarily the file that appears first in + PPAATTHH. If the --aa option is used, ttyyppee prints all of the places + that contain a command named _n_a_m_e. This includes aliases, re- + served words, functions, and builtins, but the path search op- tions (--pp and --PP) can be supplied to restrict the output to exe- - cutable files. ttyyppee does not consult the table of hashed com- + cutable files. ttyyppee does not consult the table of hashed com- mands when using --aa with --pp, and only performs a PPAATTHH search for - _n_a_m_e. The --ff option suppresses shell function lookup, as with - the ccoommmmaanndd builtin. ttyyppee returns true if all of the arguments + _n_a_m_e. The --ff option suppresses shell function lookup, as with + the ccoommmmaanndd builtin. ttyyppee returns true if all of the arguments are found, false if any are not found. uulliimmiitt [--HHSS] --aa uulliimmiitt [--HHSS] [--bbccddeeffiikkllmmnnppqqrrssttuuvvxxPPRRTT [_l_i_m_i_t]] - Provides control over the resources available to the shell and - to processes started by it, on systems that allow such control. + Provides control over the resources available to the shell and + to processes started by it, on systems that allow such control. The --HH and --SS options specify that the hard or soft limit is set - for the given resource. A hard limit cannot be increased by a - non-root user once it is set; a soft limit may be increased up - to the value of the hard limit. If neither --HH nor --SS is speci- + for the given resource. A hard limit cannot be increased by a + non-root user once it is set; a soft limit may be increased up + to the value of the hard limit. If neither --HH nor --SS is speci- fied, both the soft and hard limits are set. The value of _l_i_m_i_t can be a number in the unit specified for the resource or one of the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the - current hard limit, the current soft limit, and no limit, re- - spectively. If _l_i_m_i_t is omitted, the current value of the soft + current hard limit, the current soft limit, and no limit, re- + spectively. If _l_i_m_i_t is omitted, the current value of the soft limit of the resource is printed, unless the --HH option is given. - When more than one resource is specified, the limit name and - unit, if appropriate, are printed before the value. Other op- + When more than one resource is specified, the limit name and + unit, if appropriate, are printed before the value. Other op- tions are interpreted as follows: --aa All current limits are reported; no limits are set --bb The maximum socket buffer size --cc The maximum size of core files created --dd The maximum size of a process's data segment --ee The maximum scheduling priority ("nice") - --ff The maximum size of files written by the shell and its + --ff The maximum size of files written by the shell and its children --ii The maximum number of pending signals --kk The maximum number of kqueues that may be allocated --ll The maximum size that may be locked into memory - --mm The maximum resident set size (many systems do not honor + --mm The maximum resident set size (many systems do not honor this limit) --nn The maximum number of open file descriptors (most systems do not allow this value to be set) @@ -1883,134 +1894,134 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS --rr The maximum real-time scheduling priority --ss The maximum stack size --tt The maximum amount of cpu time in seconds - --uu The maximum number of processes available to a single + --uu The maximum number of processes available to a single user - --vv The maximum amount of virtual memory available to the + --vv The maximum amount of virtual memory available to the shell and, on some systems, to its children --xx The maximum number of file locks --PP The maximum number of pseudoterminals - --RR The maximum time a real-time process can run before + --RR The maximum time a real-time process can run before blocking, in microseconds --TT The maximum number of threads - If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the - new value of the specified resource. If no option is given, - then --ff is assumed. Values are in 1024-byte increments, except - for --tt, which is in seconds; --RR, which is in microseconds; --pp, - which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and - --uu, which are unscaled values; and, when in posix mode, --cc and - --ff, which are in 512-byte increments. The return status is 0 - unless an invalid option or argument is supplied, or an error + If _l_i_m_i_t is given, and the --aa option is not used, _l_i_m_i_t is the + new value of the specified resource. If no option is given, + then --ff is assumed. Values are in 1024-byte increments, except + for --tt, which is in seconds; --RR, which is in microseconds; --pp, + which is in units of 512-byte blocks; --PP, --TT, --bb, --kk, --nn, and + --uu, which are unscaled values; and, when in posix mode, --cc and + --ff, which are in 512-byte increments. The return status is 0 + unless an invalid option or argument is supplied, or an error occurs while setting a new limit. uummaasskk [--pp] [--SS] [_m_o_d_e] The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with - a digit, it is interpreted as an octal number; otherwise it is - interpreted as a symbolic mode mask similar to that accepted by - _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is - printed. The --SS option causes the mask to be printed in sym- - bolic form; the default output is an octal number. If the --pp + a digit, it is interpreted as an octal number; otherwise it is + interpreted as a symbolic mode mask similar to that accepted by + _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is + printed. The --SS option causes the mask to be printed in sym- + bolic form; the default output is an octal number. If the --pp option is supplied, and _m_o_d_e is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode - was successfully changed or if no _m_o_d_e argument was supplied, + was successfully changed or if no _m_o_d_e argument was supplied, and false otherwise. uunnaalliiaass [-aa] [_n_a_m_e ...] - Remove each _n_a_m_e from the list of defined aliases. If --aa is - supplied, all alias definitions are removed. The return value + Remove each _n_a_m_e from the list of defined aliases. If --aa is + supplied, all alias definitions are removed. The return value is true unless a supplied _n_a_m_e is not a defined alias. uunnsseett [-ffvv] [-nn] [_n_a_m_e ...] - For each _n_a_m_e, remove the corresponding variable or function. + For each _n_a_m_e, remove the corresponding variable or function. If the --vv option is given, each _n_a_m_e refers to a shell variable, - and that variable is removed. Read-only variables may not be - unset. If --ff is specified, each _n_a_m_e refers to a shell func- - tion, and the function definition is removed. If the --nn option - is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute, - _n_a_m_e will be unset rather than the variable it references. --nn - has no effect if the --ff option is supplied. If no options are - supplied, each _n_a_m_e refers to a variable; if there is no vari- - able by that name, a function with that name, if any, is unset. - Each unset variable or function is removed from the environment - passed to subsequent commands. If any of BBAASSHH__AALLIIAASSEESS, + and that variable is removed. Read-only variables may not be + unset. If --ff is specified, each _n_a_m_e refers to a shell func- + tion, and the function definition is removed. If the --nn option + is supplied, and _n_a_m_e is a variable with the _n_a_m_e_r_e_f attribute, + _n_a_m_e will be unset rather than the variable it references. --nn + has no effect if the --ff option is supplied. If no options are + supplied, each _n_a_m_e refers to a variable; if there is no vari- + able by that name, a function with that name, if any, is unset. + Each unset variable or function is removed from the environment + passed to subsequent commands. If any of BBAASSHH__AALLIIAASSEESS, BBAASSHH__AARRGGVV00, BBAASSHH__CCMMDDSS, BBAASSHH__CCOOMMMMAANNDD, BBAASSHH__SSUUBBSSHHEELLLL, BBAASSHHPPIIDD, - CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCC-- - NNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECCOONNDDSS, or SSRRAANNDDOOMM are + CCOOMMPP__WWOORRDDBBRREEAAKKSS, DDIIRRSSTTAACCKK, EEPPOOCCHHRREEAALLTTIIMMEE, EEPPOOCCHHSSEECCOONNDDSS, FFUUNNCC-- + NNAAMMEE, GGRROOUUPPSS, HHIISSTTCCMMDD, LLIINNEENNOO, RRAANNDDOOMM, SSEECCOONNDDSS, or SSRRAANNDDOOMM are unset, they lose their special properties, even if they are sub- sequently reset. The exit status is true unless a _n_a_m_e is read- only or may not be unset. wwaaiitt [--ffnn] [--pp _v_a_r_n_a_m_e] [_i_d _._._.] Wait for each specified child process and return its termination - status. Each _i_d may be a process ID or a job specification; if - a job spec is given, all processes in that job's pipeline are - waited for. If _i_d is not given, wwaaiitt waits for all running - background jobs and the last-executed process substitution, if + status. Each _i_d may be a process ID or a job specification; if + a job spec is given, all processes in that job's pipeline are + waited for. If _i_d is not given, wwaaiitt waits for all running + background jobs and the last-executed process substitution, if its process id is the same as $$!!, and the return status is zero. - If the --nn option is supplied, wwaaiitt waits for a single job from + If the --nn option is supplied, wwaaiitt waits for a single job from the list of _i_ds or, if no _i_ds are supplied, any job, to complete - and returns its exit status. If none of the supplied arguments + and returns its exit status. If none of the supplied arguments is a child of the shell, or if no arguments are supplied and the - shell has no unwaited-for children, the exit status is 127. If - the --pp option is supplied, the process or job identifier of the - job for which the exit status is returned is assigned to the - variable _v_a_r_n_a_m_e named by the option argument. The variable - will be unset initially, before any assignment. This is useful - only when the --nn option is supplied. Supplying the --ff option, - when job control is enabled, forces wwaaiitt to wait for _i_d to ter- + shell has no unwaited-for children, the exit status is 127. If + the --pp option is supplied, the process or job identifier of the + job for which the exit status is returned is assigned to the + variable _v_a_r_n_a_m_e named by the option argument. The variable + will be unset initially, before any assignment. This is useful + only when the --nn option is supplied. Supplying the --ff option, + when job control is enabled, forces wwaaiitt to wait for _i_d to ter- minate before returning its status, instead of returning when it - changes status. If _i_d specifies a non-existent process or job, - the return status is 127. If wwaaiitt is interrupted by a signal, - the return status will be greater than 128, as described under - SSIIGGNNAALLSS in _b_a_s_h_(_1_). Otherwise, the return status is the exit + changes status. If _i_d specifies a non-existent process or job, + the return status is 127. If wwaaiitt is interrupted by a signal, + the return status will be greater than 128, as described under + SSIIGGNNAALLSS in _b_a_s_h_(_1_). Otherwise, the return status is the exit status of the last process or job waited for. SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE - Bash-4.0 introduced the concept of a _s_h_e_l_l _c_o_m_p_a_t_i_b_i_l_i_t_y _l_e_v_e_l, speci- - fied as a set of options to the shopt builtin ( ccoommppaatt3311, ccoommppaatt3322, - ccoommppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibil- - ity level -- each option is mutually exclusive. The compatibility - level is intended to allow users to select behavior from previous ver- - sions that is incompatible with newer versions while they migrate - scripts to use current features and behavior. It's intended to be a + Bash-4.0 introduced the concept of a _s_h_e_l_l _c_o_m_p_a_t_i_b_i_l_i_t_y _l_e_v_e_l, speci- + fied as a set of options to the shopt builtin ( ccoommppaatt3311, ccoommppaatt3322, + ccoommppaatt4400, ccoommppaatt4411, and so on). There is only one current compatibil- + ity level -- each option is mutually exclusive. The compatibility + level is intended to allow users to select behavior from previous ver- + sions that is incompatible with newer versions while they migrate + scripts to use current features and behavior. It's intended to be a temporary solution. - This section does not mention behavior that is standard for a particu- - lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the - regexp matching operator quotes special regexp characters in the word, + This section does not mention behavior that is standard for a particu- + lar version (e.g., setting ccoommppaatt3322 means that quoting the rhs of the + regexp matching operator quotes special regexp characters in the word, which is default behavior in bash-3.2 and subsequent versions). - If a user enables, say, ccoommppaatt3322, it may affect the behavior of other - compatibility levels up to and including the current compatibility - level. The idea is that each compatibility level controls behavior - that changed in that version of bbaasshh, but that behavior may have been - present in earlier versions. For instance, the change to use locale- - based comparisons with the [[[[ command came in bash-4.1, and earlier + If a user enables, say, ccoommppaatt3322, it may affect the behavior of other + compatibility levels up to and including the current compatibility + level. The idea is that each compatibility level controls behavior + that changed in that version of bbaasshh, but that behavior may have been + present in earlier versions. For instance, the change to use locale- + based comparisons with the [[[[ command came in bash-4.1, and earlier versions used ASCII-based comparisons, so enabling ccoommppaatt3322 will enable - ASCII-based comparisons as well. That granularity may not be suffi- - cient for all uses, and as a result users should employ compatibility - levels carefully. Read the documentation for a particular feature to + ASCII-based comparisons as well. That granularity may not be suffi- + cient for all uses, and as a result users should employ compatibility + levels carefully. Read the documentation for a particular feature to find out the current behavior. - Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as- + Bash-4.3 introduced a new shell variable: BBAASSHH__CCOOMMPPAATT. The value as- signed to this variable (a decimal version number like 4.2, or an inte- - ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com- + ger corresponding to the ccoommppaatt_N_N option, like 42) determines the com- patibility level. - Starting with bash-4.4, Bash has begun deprecating older compatibility - levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM-- + Starting with bash-4.4, Bash has begun deprecating older compatibility + levels. Eventually, the options will be removed in favor of BBAASSHH__CCOOMM-- PPAATT. - Bash-5.0 is the final version for which there will be an individual - shopt option for the previous version. Users should use BBAASSHH__CCOOMMPPAATT on + Bash-5.0 is the final version for which there will be an individual + shopt option for the previous version. Users should use BBAASSHH__CCOOMMPPAATT on bash-5.0 and later versions. - The following table describes the behavior changes controlled by each + The following table describes the behavior changes controlled by each compatibility level setting. The ccoommppaatt_N_N tag is used as shorthand for setting the compatibility level to _N_N using one of the following mecha- - nisms. For versions prior to bash-5.0, the compatibility level may be - set using the corresponding ccoommppaatt_N_N shopt option. For bash-4.3 and - later versions, the BBAASSHH__CCOOMMPPAATT variable is preferred, and it is re- + nisms. For versions prior to bash-5.0, the compatibility level may be + set using the corresponding ccoommppaatt_N_N shopt option. For bash-4.3 and + later versions, the BBAASSHH__CCOOMMPPAATT variable is preferred, and it is re- quired for bash-5.1 and later versions. ccoommppaatt3311 @@ -2018,85 +2029,85 @@ SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE ator (=~) has no special effect ccoommppaatt3322 - +o interrupting a command list such as "a ; b ; c" causes - the execution of the next command in the list (in - bash-4.0 and later versions, the shell acts as if it re- - ceived the interrupt, so interrupting one command in a + +o interrupting a command list such as "a ; b ; c" causes + the execution of the next command in the list (in + bash-4.0 and later versions, the shell acts as if it re- + ceived the interrupt, so interrupting one command in a list aborts the execution of the entire list) ccoommppaatt4400 - +o the << and >> operators to the [[[[ command do not consider + +o the << and >> operators to the [[[[ command do not consider the current locale when comparing strings; they use ASCII ordering. Bash versions prior to bash-4.1 use ASCII col- - lation and _s_t_r_c_m_p(3); bash-4.1 and later use the current + lation and _s_t_r_c_m_p(3); bash-4.1 and later use the current locale's collation sequence and _s_t_r_c_o_l_l(3). ccoommppaatt4411 - +o in _p_o_s_i_x mode, ttiimmee may be followed by options and still + +o in _p_o_s_i_x mode, ttiimmee may be followed by options and still be recognized as a reserved word (this is POSIX interpre- tation 267) +o in _p_o_s_i_x mode, the parser requires that an even number of - single quotes occur in the _w_o_r_d portion of a double- - quoted parameter expansion and treats them specially, so - that characters within the single quotes are considered + single quotes occur in the _w_o_r_d portion of a double- + quoted parameter expansion and treats them specially, so + that characters within the single quotes are considered quoted (this is POSIX interpretation 221) ccoommppaatt4422 +o the replacement string in double-quoted pattern substitu- - tion does not undergo quote removal, as it does in ver- + tion does not undergo quote removal, as it does in ver- sions after bash-4.2 - +o in posix mode, single quotes are considered special when - expanding the _w_o_r_d portion of a double-quoted parameter - expansion and can be used to quote a closing brace or - other special character (this is part of POSIX interpre- - tation 221); in later versions, single quotes are not + +o in posix mode, single quotes are considered special when + expanding the _w_o_r_d portion of a double-quoted parameter + expansion and can be used to quote a closing brace or + other special character (this is part of POSIX interpre- + tation 221); in later versions, single quotes are not special within double-quoted word expansions ccoommppaatt4433 - +o the shell does not print a warning message if an attempt - is made to use a quoted compound assignment as an argu- - ment to declare (e.g., declare -a foo='(1 2)'). Later + +o the shell does not print a warning message if an attempt + is made to use a quoted compound assignment as an argu- + ment to declare (e.g., declare -a foo='(1 2)'). Later versions warn that this usage is deprecated - +o word expansion errors are considered non-fatal errors - that cause the current command to fail, even in posix - mode (the default behavior is to make them fatal errors + +o word expansion errors are considered non-fatal errors + that cause the current command to fail, even in posix + mode (the default behavior is to make them fatal errors that cause the shell to exit) - +o when executing a shell function, the loop state + +o when executing a shell function, the loop state (while/until/etc.) is not reset, so bbrreeaakk or ccoonnttiinnuuee in that function will break or continue loops in the calling - context. Bash-4.4 and later reset the loop state to pre- + context. Bash-4.4 and later reset the loop state to pre- vent this ccoommppaatt4444 - +o the shell sets up the values used by BBAASSHH__AARRGGVV and - BBAASSHH__AARRGGCC so they can expand to the shell's positional + +o the shell sets up the values used by BBAASSHH__AARRGGVV and + BBAASSHH__AARRGGCC so they can expand to the shell's positional parameters even if extended debugging mode is not enabled - +o a subshell inherits loops from its parent context, so - bbrreeaakk or ccoonnttiinnuuee will cause the subshell to exit. - Bash-5.0 and later reset the loop state to prevent the + +o a subshell inherits loops from its parent context, so + bbrreeaakk or ccoonnttiinnuuee will cause the subshell to exit. + Bash-5.0 and later reset the loop state to prevent the exit - +o variable assignments preceding builtins like eexxppoorrtt and + +o variable assignments preceding builtins like eexxppoorrtt and rreeaaddoonnllyy that set attributes continue to affect variables with the same name in the calling environment even if the shell is not in posix mode ccoommppaatt5500 - +o Bash-5.1 changed the way $$RRAANNDDOOMM is generated to intro- + +o Bash-5.1 changed the way $$RRAANNDDOOMM is generated to intro- duce slightly more randomness. If the shell compatibility - level is set to 50 or lower, it reverts to the method - from bash-5.0 and previous versions, so seeding the ran- - dom number generator by assigning a value to RRAANNDDOOMM will + level is set to 50 or lower, it reverts to the method + from bash-5.0 and previous versions, so seeding the ran- + dom number generator by assigning a value to RRAANNDDOOMM will produce the same sequence as in bash-5.0 - +o If the command hash table is empty, bash versions prior - to bash-5.1 printed an informational message to that ef- - fect, even when producing output that can be reused as - input. Bash-5.1 suppresses that message when the --ll op- + +o If the command hash table is empty, bash versions prior + to bash-5.1 printed an informational message to that ef- + fect, even when producing output that can be reused as + input. Bash-5.1 suppresses that message when the --ll op- tion is supplied. ccoommppaatt5511 - +o The uunnsseett builtin treats attempts to unset array sub- - scripts @@ and ** differently depending on whether the ar- - ray is indexed or associative, and differently than in + +o The uunnsseett builtin treats attempts to unset array sub- + scripts @@ and ** differently depending on whether the ar- + ray is indexed or associative, and differently than in previous versions. SSEEEE AALLSSOO diff --git a/doc/version.texi b/doc/version.texi index 479b804b..8dd2de79 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2023 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Fri Jan 27 15:17:14 EST 2023 +@set LASTCHANGE Tue Feb 7 15:46:55 EST 2023 @set EDITION 5.2 @set VERSION 5.2 -@set UPDATED 27 January 2023 -@set UPDATED-MONTH January 2023 +@set UPDATED 7 February 2023 +@set UPDATED-MONTH February 2023 diff --git a/input.c b/input.c index 76496cd5..73ffa3ec 100644 --- a/input.c +++ b/input.c @@ -479,6 +479,10 @@ b_fill_buffer (BUFFERED_STREAM *bp) off_t o; CHECK_TERMSIG; + + if (bp->b_flag & B_ERROR) /* try making read errors `sticky' */ + return EOF; + /* In an environment where text and binary files are treated differently, compensate for lseek() on text files returning an offset different from the count of characters read() returns. Text-mode streams have to be diff --git a/input.h b/input.h index f4d91b04..09a42119 100644 --- a/input.h +++ b/input.h @@ -67,6 +67,10 @@ extern int bash_input_fd_changed; #define beof(bp) (((bp)->b_flag & B_EOF) != 0) #define berror(bp) (((bp)->b_flag & B_ERROR) != 0) +#undef bclearerror + +#define bclearerror(bp) ((bp)->b_flag &= ~(B_ERROR|B_EOF)) + #endif /* BUFFERED_INPUT */ typedef union { diff --git a/parse.y b/parse.y index f5199f15..379fdaad 100644 --- a/parse.y +++ b/parse.y @@ -176,7 +176,7 @@ static int yy_stream_unget (int); static int shell_getc (int); static void shell_ungetc (int); -static void discard_until (int); +static int discard_until (int); static void push_string (char *, int, alias_t *); static void pop_string (void); @@ -2822,7 +2822,7 @@ shell_ungetchar (void) /* Discard input until CHARACTER is seen, then push that character back onto the input stream. */ -static void +static int discard_until (int character) { int c; @@ -2832,6 +2832,7 @@ discard_until (int character) if (c != EOF) shell_ungetc (c); + return (c); } void @@ -3440,7 +3441,13 @@ read_token (int command) { /* A comment. Discard until EOL or EOF, and then return a newline. */ parser_state |= PST_COMMENT; - discard_until ('\n'); + character = discard_until ('\n'); + if (character == EOF) + { + parser_state &= ~PST_COMMENT; + EOF_Reached = 1; + return (yacc_EOF); /* XXX */ + } shell_getc (0); parser_state &= ~PST_COMMENT; character = '\n'; /* this will take the next if statement and return. */