From 81ddb6474bbeed1744ff0573aadc6ddeb7efbeee Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Fri, 28 Aug 2026 15:35:54 -0400 Subject: [PATCH] documentation updates for history builtin to note it does not truncate the history file; documentation updates for HISTFILESIZE noting that it can work on lines or history entries depending on $HISTTIMEFORMAT; documentation update for history saving behavior at shell exit; history -w and history -a should update the number of history entries in the current session if they are using $HISTFILE; history -r now updates the number of history entries in the current session; improvement to history_truncate_file so it leaves fewer partial history entries when operating on lines --- CWRU/CWRU.chlog | 55 + bashhist.c | 13 +- bashhist.h | 2 +- builtins/common.c | 30 + builtins/common.h | 2 + builtins/history.def | 13 +- builtins/mapfile.def | 4 + doc/bash.0 | 2990 +++++++++++++++++----------------- doc/bash.1 | 76 +- doc/bash.info | 312 ++-- doc/bashref.info | 312 ++-- doc/bashref.texi | 26 +- doc/version.texi | 4 +- examples/loadables/asort.c | 38 +- lib/readline/doc/hsuser.texi | 41 +- lib/readline/histfile.c | 8 + 16 files changed, 2086 insertions(+), 1840 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 38a53e53..16479fde 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -13261,3 +13261,58 @@ shell.c `bash -in << + + 8/24 + ---- +doc/bash.1,doc/bashref.texi + - HISTFILESIZE: correct description to delete text saying the history + builtin truncates the history file after writing; bash has never + done that. + From https://savannah.gnu.org/bugs/?68641 + + 8/27 + ---- +builtins/history.def + - history_builtin: if we are using $HISTFILE, history -w should + reset history_lines_this_session to 0 to avoid appending duplicate + entries to the history file on shell exit. This should not affect + idioms people use to share a single history file between multiple + shell sessions; most of those use `history -a', which already + resets history_lines_this_session + - history_builtin: if we are using $HISTFILE, history -a should reset + history_lines_this_session to 0 + - history_builtin: history -r should increase history_lines_this_session + by the number of lines read from the file, even if it's $HISTFILE + From https://savannah.gnu.org/bugs/index.php?68646 + +bashhist.c + - maybe_append_history: takes a second argument saying whether or not + we are using $HISTFILE, changed callers + - maybe_append_history: reset history_lines_this_session and + history_lines_in_file only if we are using $HISTFILE + +doc/bash.1,lib/readline/doc/hsuser.texi + - make the text describing how bash saves the shell history upon exit + match the actual behavior, making it clear that bash tries to + append the entries from the current session to $HISTFILE and only + overwrites the file if the number of entries from the current + session exceeds $HISTSIZE + From https://savannah.gnu.org/bugs/index.php?68645 + +lib/readline/histfile.c + - history_truncate_file: use the same heuristic as read_history_range + to determine whether the history file has timestamps, and add 1 + to lines even if we're not going by history entries so we (maybe) + get a timestamp before the first line, which we hope is the first + line of a command + +doc/bash.1,doc/bashref.texi,lib/readline/doc/hsuser.texi + - update the description of HISTFILESIZE to note that it can refer + to either lines or possibly multi-line history entries depending + on whether HISTTIMEFORMAT is set + - update the history section to describe how HISTTIMEFORMAT affects + how $HISTFILESIZE is interpreted (lines vs. entries) and note that + if we are dealing with lines, there might be more lines than the + maximum in the file to avoid partial history entries or history + entries without a timestamp (if the file has them) + From https://savannah.gnu.org/bugs/?68650 diff --git a/bashhist.c b/bashhist.c index 03971c44..4f5d446f 100644 --- a/bashhist.c +++ b/bashhist.c @@ -1,6 +1,6 @@ /* bashhist.c -- bash interface to the GNU history library. */ -/* Copyright (C) 1993-2024 Free Software Foundation, Inc. +/* Copyright (C) 1993-2026 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -447,7 +447,7 @@ save_history (void) #endif int -maybe_append_history (char *filename) +maybe_append_history (char *filename, int is_histfile) { int fd, result, histlen; struct stat buf; @@ -471,10 +471,13 @@ maybe_append_history (char *filename) if (histlen > 0 && history_lines_this_session > histlen) history_lines_this_session = histlen; /* reset below anyway */ result = append_history (history_lines_this_session, filename); - /* Pretend we already read these lines from the file because we just + /* Pretend we already read these lines from $HISTFILE because we just added them */ - history_lines_in_file += history_lines_this_session; - history_lines_this_session = 0; + if (is_histfile) + { + history_lines_in_file += history_lines_this_session; + history_lines_this_session = 0; + } } else history_lines_this_session = 0; /* reset if > where_history() */ diff --git a/bashhist.h b/bashhist.h index e3ca4fd8..dcdbdff8 100644 --- a/bashhist.h +++ b/bashhist.h @@ -75,7 +75,7 @@ extern int bash_delete_last_history (void); extern void load_history (void); extern void save_history (void); extern char *bash_default_histfile (void); -extern int maybe_append_history (char *); +extern int maybe_append_history (char *, int); extern int maybe_save_shell_history (void); extern char *pre_process_line (char *, int, int); extern void maybe_add_history (char *); diff --git a/builtins/common.c b/builtins/common.c index a781a0fa..36db0252 100644 --- a/builtins/common.c +++ b/builtins/common.c @@ -1013,6 +1013,36 @@ builtin_find_indexed_array (char *array_name, int flags) return entry; } + +SHELL_VAR * +builtin_find_array (char *array_name, int flags) +{ + SHELL_VAR *entry; + + if ((flags & 2) && valid_identifier (array_name) == 0) + { + sh_invalidid (array_name); + return (SHELL_VAR *)NULL; + } + + entry = find_or_make_array_variable (array_name, 1); + /* With flags argument & 1, find_or_make_array_variable checks for readonly + and noassign variables and prints error messages. */ + if (entry == 0) + return entry; + else if (array_p (entry) == 0 && assoc_p (entry) == 0) + { + builtin_error (_("%s: not an array"), array_name); + return (SHELL_VAR *)NULL; + } + else if (invisible_p (entry)) + VUNSETATTR (entry, att_invisible); /* no longer invisible */ + + if (array_p (entry) && (flags & 1)) + array_flush (array_cell (entry)); + + return entry; +} #endif /* ARRAY_VARS */ /* Like check_unbind_variable, but for use by builtins (only matters for diff --git a/builtins/common.h b/builtins/common.h index ec717f5f..6efed8e3 100644 --- a/builtins/common.h +++ b/builtins/common.h @@ -240,6 +240,8 @@ extern SHELL_VAR *builtin_bind_var_to_int (char *, intmax_t, int); extern int builtin_unbind_variable (const char *); extern SHELL_VAR *builtin_find_indexed_array (char *, int); +extern SHELL_VAR *builtin_find_array (char *, int); + extern int builtin_arrayref_flags (WORD_DESC *, int); /* variables from evalfile.c */ diff --git a/builtins/history.def b/builtins/history.def index 1139e7e6..1c35d5b9 100644 --- a/builtins/history.def +++ b/builtins/history.def @@ -131,7 +131,7 @@ static int expand_and_print_history (WORD_LIST *); int history_builtin (WORD_LIST *list) { - int flags, opt, result, old_history_lines, obase, ind; + int flags, opt, result, old_history_lines, obase, ind, using_histfile; char *filename, *newfn, *delete_arg, *range; intmax_t delete_offset; @@ -266,6 +266,7 @@ history_builtin (WORD_LIST *list) } filename = list ? list->word->word : get_string_value ("HISTFILE"); + using_histfile = list == NULL; result = EXECUTION_SUCCESS; if (filename == 0 || *filename == 0) @@ -290,7 +291,11 @@ history_builtin (WORD_LIST *list) #endif if (flags & AFLAG) /* Append session's history to file. */ - result = maybe_append_history (filename); + { + result = maybe_append_history (filename, using_histfile); + if (using_histfile) + history_lines_this_session = 0; + } else if (flags & WFLAG) /* Write entire history. */ { result = write_history (filename); @@ -299,6 +304,8 @@ history_builtin (WORD_LIST *list) I/O and permission errors. */ if (result > 0) history_error (filename, result, 0); + if (result == 0 && using_histfile) + history_lines_this_session = 0; } else if (flags & RFLAG) /* Read entire file. */ { @@ -310,6 +317,8 @@ history_builtin (WORD_LIST *list) I/O and permission errors. */ if (result > 0) history_error (filename, result, 1); + if (result == 0) + history_lines_this_session += history_lines_read_from_file; } else if (flags & NFLAG) /* Read `new' history from file. */ { diff --git a/builtins/mapfile.def b/builtins/mapfile.def index 5b015016..b867cff6 100644 --- a/builtins/mapfile.def +++ b/builtins/mapfile.def @@ -162,6 +162,10 @@ mapfile (int fd, long line_count_goal, long origin, long nskip, long callback_qu /* If the delimiter is a newline, turn on unbuffered reads for pipes (terminals are ok). If the delimiter is not a newline, unbuffered reads for every file descriptor that's not a regular file. */ + /* We could check that the delimiter is a newline and the input is a + terminal and force buffered reads in that case, letting the kernel find + the newline for us, or set the VISABLE character like the read builtin + does and let the kernel detect it. */ if (delim == '\n') unbuffered_read = (lseek (fd, 0L, SEEK_CUR) < 0) && (errno == ESPIPE); else diff --git a/doc/bash.0 b/doc/bash.0 index ed1b9c3c..359f699d 100644 --- a/doc/bash.0 +++ b/doc/bash.0 @@ -1345,180 +1345,180 @@ PPAARRAAMMEETTEERRSS FFIILLEE is unset or null, the shell does not save the command history when it exits. HHIISSTTFFIILLEESSIIZZEE - The maximum number of lines contained in the history file. When - this variable is assigned a value, the history file is truncated, if - necessary, to contain no more than the number of history entries - that total no more than that number of lines by removing the oldest - entries. If the history list contains multi-line entries, the his- - tory file may contain more lines than this maximum to avoid leaving - partial history entries. The history file is also truncated to this - size after writing it when a shell exits or by the hhiissttoorryy builtin. - If the value is 0, the history file is truncated to zero size. Non- - numeric values and numeric values less than zero inhibit truncation. - The shell sets the default value to the value of HHIISSTTSSIIZZEE after + The maximum number of lines or history entries contained in the his- + tory file. When this variable is assigned a value, the history file + is truncated, if necessary, to contain no more than the number of + history entries or lines, depending on whether HHIISSTTTTIIMMEEFFOORRMMAATT is + set, by removing the oldest entries. See HHIISSTTOORRYY below for a de- + scription of how HHIISSTTTTIIMMEEFFOORRMMAATT affects how the value is treated and + whether it refers to lines or history entries. The history file is + also truncated to this size after writing it when a shell exits. If + the value is 0, the history file is truncated to zero size. Non-nu- + meric values and numeric values less than zero inhibit truncation. + The shell sets the default value to the value of HHIISSTTSSIIZZEE after reading any startup files. HHIISSTTIIGGNNOORREE - A colon-separated list of patterns used to decide which command - lines should be saved on the history list. If a command line - matches one of the patterns in the value of HHIISSTTIIGGNNOORREE, it is not - saved on the history list. Each pattern is anchored at the begin- - ning of the line and must match the complete line (bbaasshh does not - implicitly append a "**"). Each pattern is tested against the line - after the checks specified by HHIISSTTCCOONNTTRROOLL are applied. In addition - to the normal shell pattern matching characters, "&&" matches the - previous history line. A backslash escapes the "&&"; the backslash + A colon-separated list of patterns used to decide which command + lines should be saved on the history list. If a command line + matches one of the patterns in the value of HHIISSTTIIGGNNOORREE, it is not + saved on the history list. Each pattern is anchored at the begin- + ning of the line and must match the complete line (bbaasshh does not + implicitly append a "**"). Each pattern is tested against the line + after the checks specified by HHIISSTTCCOONNTTRROOLL are applied. In addition + to the normal shell pattern matching characters, "&&" matches the + previous history line. A backslash escapes the "&&"; the backslash is removed before attempting a match. If the first line of a multi- line compound command was saved, the second and subsequent lines are - not tested, and are added to the history regardless of the value of - HHIISSTTIIGGNNOORREE. If the first line was not saved, the second and subse- + not tested, and are added to the history regardless of the value of + HHIISSTTIIGGNNOORREE. If the first line was not saved, the second and subse- quent lines of the command are not saved either. The pattern match- ing honors the setting of the eexxttgglloobb shell option. - HHIISSTTIIGGNNOORREE subsumes some of the function of HHIISSTTCCOONNTTRROOLL. A pattern - of "&" is identical to "ignoredups", and a pattern of "[ ]*" is - identical to "ignorespace". Combining these two patterns, separat- + HHIISSTTIIGGNNOORREE subsumes some of the function of HHIISSTTCCOONNTTRROOLL. A pattern + of "&" is identical to "ignoredups", and a pattern of "[ ]*" is + identical to "ignorespace". Combining these two patterns, separat- ing them with a colon, provides the functionality of "ignoreboth". HHIISSTTSSIIZZEE - The number of commands to remember in the command history (see HHIISS-- - TTOORRYY below). If the value is 0, commands are not saved in the his- - tory list. Numeric values less than zero result in every command + The number of commands to remember in the command history (see HHIISS-- + TTOORRYY below). If the value is 0, commands are not saved in the his- + tory list. Numeric values less than zero result in every command being saved on the history list (there is no limit). The shell sets the default value to 500 after reading any startup files. HHIISSTTTTIIMMEEFFOORRMMAATT - If this variable is set and not null, its value is used as a format - string for _s_t_r_f_t_i_m_e(3) to print the time stamp associated with each + If this variable is set and not null, its value is used as a format + string for _s_t_r_f_t_i_m_e(3) to print the time stamp associated with each history entry displayed by the hhiissttoorryy builtin. If this variable is set, the shell writes time stamps to the history file so they may be - preserved across shell sessions. This uses the history comment + preserved across shell sessions. This uses the history comment character to distinguish timestamps from other history lines. HHOOMMEE The home directory of the current user; the default argument for the - ccdd builtin command. The value of this variable is also used when + ccdd builtin command. The value of this variable is also used when performing tilde expansion. HHOOSSTTFFIILLEE - Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s that - should be read when the shell needs to complete a hostname. The + Contains the name of a file in the same format as _/_e_t_c_/_h_o_s_t_s that + should be read when the shell needs to complete a hostname. The list of possible hostname completions may be changed while the shell is running; the next time hostname completion is attempted after the - value is changed, bbaasshh adds the contents of the new file to the ex- + value is changed, bbaasshh adds the contents of the new file to the ex- isting list. If HHOOSSTTFFIILLEE is set, but has no value, or does not name a readable file, bbaasshh attempts to read _/_e_t_c_/_h_o_s_t_s to obtain the list - of possible hostname completions. When HHOOSSTTFFIILLEE is unset, bbaasshh + of possible hostname completions. When HHOOSSTTFFIILLEE is unset, bbaasshh clears the hostname list. - IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting after - expansion and to split lines into words with the rreeaadd builtin com- - mand. Word splitting is described below under EEXXPPAANNSSIIOONN. The de- + IIFFSS The _I_n_t_e_r_n_a_l _F_i_e_l_d _S_e_p_a_r_a_t_o_r that is used for word splitting after + expansion and to split lines into words with the rreeaadd builtin com- + mand. Word splitting is described below under EEXXPPAANNSSIIOONN. The de- fault value is "". IIGGNNOORREEEEOOFF - Controls the action of an interactive shell on receipt of an EEOOFF - character as the sole input. If set, the value is the number of - consecutive EEOOFF characters which must be typed as the first charac- + Controls the action of an interactive shell on receipt of an EEOOFF + character as the sole input. If set, the value is the number of + consecutive EEOOFF characters which must be typed as the first charac- ters on an input line before bbaasshh exits. If the variable is set but - does not have a numeric value, or the value is null, the default - value is 10. If it is unset, EEOOFF signifies the end of input to the + does not have a numeric value, or the value is null, the default + value is 10. If it is unset, EEOOFF signifies the end of input to the shell. IINNPPUUTTRRCC - The filename for the rreeaaddlliinnee startup file, overriding the default + The filename for the rreeaaddlliinnee startup file, overriding the default of _~_/_._i_n_p_u_t_r_c (see RREEAADDLLIINNEE below). IINNSSIIDDEE__EEMMAACCSS - If this variable appears in the environment when the shell starts, + If this variable appears in the environment when the shell starts, bbaasshh assumes that it is running inside an Emacs shell buffer and may disable line editing, depending on the value of TTEERRMM. - LLAANNGG Used to determine the locale category for any category not specifi- + LLAANNGG Used to determine the locale category for any category not specifi- cally selected with a variable starting with LLCC__. LLCC__AALLLL This variable overrides the value of LLAANNGG and any other LLCC__ variable specifying a locale category. LLCC__CCOOLLLLAATTEE - This variable determines the collation order used when sorting the - results of pathname expansion, and determines the behavior of range - expressions, equivalence classes, and collating sequences within + This variable determines the collation order used when sorting the + results of pathname expansion, and determines the behavior of range + expressions, equivalence classes, and collating sequences within pathname expansion and pattern matching. LLCC__CCTTYYPPEE - This variable determines the interpretation of characters and the - behavior of character classes within pathname expansion and pattern + This variable determines the interpretation of characters and the + behavior of character classes within pathname expansion and pattern matching. LLCC__MMEESSSSAAGGEESS - This variable determines the locale used to translate double-quoted + This variable determines the locale used to translate double-quoted strings preceded by a $$. LLCC__NNUUMMEERRIICC This variable determines the locale category used for number format- ting. LLCC__TTIIMMEE - This variable determines the locale category used for data and time + This variable determines the locale category used for data and time formatting. - LLIINNEESS Used by the sseelleecctt compound command to determine the column length + LLIINNEESS Used by the sseelleecctt compound command to determine the column length for printing selection lists. Automatically set if the cchheecckkwwiinnssiizzee - option is enabled or in an interactive shell upon receipt of a SSIIGG-- + option is enabled or in an interactive shell upon receipt of a SSIIGG-- WWIINNCCHH. - MMAAIILL If the value is set to a file or directory name and the MMAAIILLPPAATTHH + MMAAIILL If the value is set to a file or directory name and the MMAAIILLPPAATTHH variable is not set, bbaasshh informs the user of the arrival of mail in the specified file or Maildir-format directory. MMAAIILLCCHHEECCKK - Specifies how often (in seconds) bbaasshh checks for mail. The default + Specifies how often (in seconds) bbaasshh checks for mail. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or - set to a value that is not a number greater than or equal to zero, + set to a value that is not a number greater than or equal to zero, the shell disables mail checking. MMAAIILLPPAATTHH - A colon-separated list of filenames to be checked for mail. The - message to be printed when mail arrives in a particular file may be - specified by separating the filename from the message with a "?". - When used in the text of the message, $$__ expands to the name of the + A colon-separated list of filenames to be checked for mail. The + message to be printed when mail arrives in a particular file may be + specified by separating the filename from the message with a "?". + When used in the text of the message, $$__ expands to the name of the current mailfile. For example: MMAAIILLPPAATTHH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"' - BBaasshh can be configured to supply a default value for this variable - (there is no value by default), but the location of the user mail + BBaasshh can be configured to supply a default value for this variable + (there is no value by default), but the location of the user mail files that it uses is system dependent (e.g., /var/mail/$$UUSSEERR). OOPPTTEERRRR If set to the value 1, bbaasshh displays error messages generated by the - ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). OOPPTTEERRRR + ggeettooppttss builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). OOPPTTEERRRR is initialized to 1 each time the shell is invoked or a shell script is executed. - PPAATTHH The search path for commands. It is a colon-separated list of di- - rectories in which the shell looks for commands (see CCOOMMMMAANNDD EEXXEECCUU-- - TTIIOONN below). A zero-length (null) directory name in the value of + PPAATTHH The search path for commands. It is a colon-separated list of di- + rectories in which the shell looks for commands (see CCOOMMMMAANNDD EEXXEECCUU-- + TTIIOONN below). A zero-length (null) directory name in the value of PPAATTHH indicates the current directory. A null directory name may ap- - pear as two adjacent colons, or as an initial or trailing colon. - The default path is system-dependent, and is set by the administra- + pear as two adjacent colons, or as an initial or trailing colon. + The default path is system-dependent, and is set by the administra- tor who installs bbaasshh. A common value is /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin PPOOSSIIXXLLYY__CCOORRRREECCTT - If this variable is in the environment when bbaasshh starts, the shell - enters posix mode before reading the startup files, as if the + If this variable is in the environment when bbaasshh starts, the shell + enters posix mode before reading the startup files, as if the ----ppoossiixx invocation option had been supplied. If it is set while the shell is running, bbaasshh enables posix mode, as if the command "set -o posix" had been executed. When the shell enters posix mode, it sets this variable if it was not already set. PPRROOMMPPTT__CCOOMMMMAANNDD If this variable is set, and is an array, the value of each set ele- - ment is executed as a command prior to issuing each primary prompt. - If this is set but not an array variable, its value is used as a + ment is executed as a command prior to issuing each primary prompt. + If this is set but not an array variable, its value is used as a command to execute instead. PPRROOMMPPTT__DDIIRRTTRRIIMM - If set to a number greater than zero, the value is used as the num- + If set to a number greater than zero, the value is used as the num- ber of trailing directory components to retain when expanding the \\ww - and \\WW prompt string escapes (see PPRROOMMPPTTIINNGG below). Characters re- + and \\WW prompt string escapes (see PPRROOMMPPTTIINNGG below). Characters re- moved are replaced with an ellipsis. - PPSS00 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) and - displayed by interactive shells after reading a command and before + PPSS00 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) and + displayed by interactive shells after reading a command and before the command is executed. - PPSS11 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) and + PPSS11 The value of this parameter is expanded (see PPRROOMMPPTTIINNGG below) and used as the primary prompt string. The default value is "\s-\v\$ ". - PPSS22 The value of this parameter is expanded as with PPSS11 and used as the + PPSS22 The value of this parameter is expanded as with PPSS11 and used as the secondary prompt string. The default is "> ". - PPSS33 The value of this parameter is used as the prompt for the sseelleecctt + PPSS33 The value of this parameter is used as the prompt for the sseelleecctt command (see SSHHEELLLL GGRRAAMMMMAARR above). PPSS44 The value of this parameter is expanded as with PPSS11 and the value is printed before each command bbaasshh displays during an execution trace. - The first character of the expanded value of PPSS44 is replicated mul- - tiple times, as necessary, to indicate multiple levels of indirec- + The first character of the expanded value of PPSS44 is replicated mul- + tiple times, as necessary, to indicate multiple levels of indirec- tion. The default is "+ ". - SSHHEELLLL This variable expands to the full pathname to the shell. If it is - not set when the shell starts, bbaasshh assigns to it the full pathname + SSHHEELLLL This variable expands to the full pathname to the shell. If it is + not set when the shell starts, bbaasshh assigns to it the full pathname of the current user's login shell. TTIIMMEEFFOORRMMAATT - The value of this parameter is used as a format string specifying - how the timing information for pipelines prefixed with the ttiimmee re- - served word should be displayed. The %% character introduces an es- + The value of this parameter is used as a format string specifying + how the timing information for pipelines prefixed with the ttiimmee re- + served word should be displayed. The %% character introduces an es- cape sequence that is expanded to a time value or other information. The escape sequences and their meanings are as follows; the brackets denote optional portions. @@ -1528,26 +1528,26 @@ PPAARRAAMMEETTEERRSS %%[[_p]][[ll]]SS The number of CPU seconds spent in system mode. %%PP The CPU percentage, computed as (%U + %S) / %R. - The optional _p is a digit specifying the _p_r_e_c_i_s_i_o_n, the number of - fractional digits after a decimal point. A value of 0 causes no - decimal point or fraction to be output. ttiimmee prints at most six - digits after the decimal point; values of _p greater than 6 are + The optional _p is a digit specifying the _p_r_e_c_i_s_i_o_n, the number of + fractional digits after a decimal point. A value of 0 causes no + decimal point or fraction to be output. ttiimmee prints at most six + digits after the decimal point; values of _p greater than 6 are changed to 6. If _p is not specified, ttiimmee prints three digits after the decimal point. - The optional ll specifies a longer format, including minutes, of the - form _M_Mm_S_S._F_Fs. The value of _p determines whether or not the frac- + The optional ll specifies a longer format, including minutes, of the + form _M_Mm_S_S._F_Fs. The value of _p determines whether or not the frac- tion is included. - If this variable is not set, bbaasshh acts as if it had the value - $$''\\nnrreeaall\\tt%%33llRR\\nnuusseerr\\tt%%33llUU\\nnssyyss\\tt%%33llSS''. If the value is null, bbaasshh - does not display any timing information. A trailing newline is + If this variable is not set, bbaasshh acts as if it had the value + $$''\\nnrreeaall\\tt%%33llRR\\nnuusseerr\\tt%%33llUU\\nnssyyss\\tt%%33llSS''. If the value is null, bbaasshh + does not display any timing information. A trailing newline is added when the format string is displayed. TTMMOOUUTT If set to a value greater than zero, the rreeaadd builtin uses the value as its default timeout. The sseelleecctt command terminates if input does not arrive after TTMMOOUUTT seconds when input is coming from a terminal. - In an interactive shell, the value is interpreted as the number of - seconds to wait for a line of input after issuing the primary + In an interactive shell, the value is interpreted as the number of + seconds to wait for a line of input after issuing the primary prompt. BBaasshh terminates after waiting for that number of seconds if a complete line of input does not arrive. TTMMPPDDIIRR @@ -1555,59 +1555,59 @@ PPAARRAAMMEETTEERRSS creates temporary files for the shell's use. aauuttoo__rreessuummee This variable controls how the shell interacts with the user and job - control. If this variable is set, simple commands consisting of - only a single word, without redirections, are treated as candidates - for resumption of an existing stopped job. There is no ambiguity - allowed; if there is more than one job beginning with or containing - the word, this selects the most recently accessed job. The _n_a_m_e of - a stopped job, in this context, is the command line used to start - it, as displayed by jjoobbss. If set to the value _e_x_a_c_t, the word must - match the name of a stopped job exactly; if set to _s_u_b_s_t_r_i_n_g, the - word needs to match a substring of the name of a stopped job. The - _s_u_b_s_t_r_i_n_g value provides functionality analogous to the %%?? job - identifier (see JJOOBB CCOONNTTRROOLL below). If set to any other value - (e.g., _p_r_e_f_i_x), the word must be a prefix of a stopped job's name; + control. If this variable is set, simple commands consisting of + only a single word, without redirections, are treated as candidates + for resumption of an existing stopped job. There is no ambiguity + allowed; if there is more than one job beginning with or containing + the word, this selects the most recently accessed job. The _n_a_m_e of + a stopped job, in this context, is the command line used to start + it, as displayed by jjoobbss. If set to the value _e_x_a_c_t, the word must + match the name of a stopped job exactly; if set to _s_u_b_s_t_r_i_n_g, the + word needs to match a substring of the name of a stopped job. The + _s_u_b_s_t_r_i_n_g value provides functionality analogous to the %%?? job + identifier (see JJOOBB CCOONNTTRROOLL below). If set to any other value + (e.g., _p_r_e_f_i_x), the word must be a prefix of a stopped job's name; this provides functionality analogous to the %%_s_t_r_i_n_g job identifier. hhiissttcchhaarrss - The two or three characters which control history expansion, quick - substitution, and tokenization (see HHIISSTTOORRYY EEXXPPAANNSSIIOONN below). The - first character is the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, the character - which begins a history expansion, normally "!!". The second charac- - ter is the _q_u_i_c_k _s_u_b_s_t_i_t_u_t_i_o_n character, normally "^^". When it ap- - pears as the first character on the line, history substitution re- - peats the previous command, replacing one string with another. The + The two or three characters which control history expansion, quick + substitution, and tokenization (see HHIISSTTOORRYY EEXXPPAANNSSIIOONN below). The + first character is the _h_i_s_t_o_r_y _e_x_p_a_n_s_i_o_n character, the character + which begins a history expansion, normally "!!". The second charac- + ter is the _q_u_i_c_k _s_u_b_s_t_i_t_u_t_i_o_n character, normally "^^". When it ap- + pears as the first character on the line, history substitution re- + peats the previous command, replacing one string with another. The optional third character is the _h_i_s_t_o_r_y _c_o_m_m_e_n_t character, normally - "##", which indicates that the remainder of the line is a comment - when it appears as the first character of a word. The history com- + "##", which indicates that the remainder of the line is a comment + when it appears as the first character of a word. The history com- ment character disables history substitution for the remaining words - on the line. It does not necessarily cause the shell parser to + on the line. It does not necessarily cause the shell parser to treat the rest of the line as a comment. AArrrraayyss BBaasshh provides one-dimensional indexed and associative array variables. Any - variable may be used as an indexed array; the ddeeccllaarree builtin explicitly - declares an array. There is no maximum limit on the size of an array, nor - any requirement that members be indexed or assigned contiguously. Indexed - arrays are referenced using arithmetic expressions that must expand to an - integer (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below) and are zero-based; associative + variable may be used as an indexed array; the ddeeccllaarree builtin explicitly + declares an array. There is no maximum limit on the size of an array, nor + any requirement that members be indexed or assigned contiguously. Indexed + arrays are referenced using arithmetic expressions that must expand to an + integer (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below) and are zero-based; associative arrays are referenced using arbitrary strings. Unless otherwise noted, in- dexed array indices must be non-negative integers. - The shell performs parameter and variable expansion, arithmetic expansion, + The shell performs parameter and variable expansion, arithmetic expansion, command substitution, and quote removal on indexed array subscripts. Since - this can potentially result in empty strings, subscript indexing treats + this can potentially result in empty strings, subscript indexing treats those as expressions that evaluate to 0. - The shell performs tilde expansion, parameter and variable expansion, - arithmetic expansion, command substitution, and quote removal on associa- - tive array subscripts. Empty strings cannot be used as associative array + The shell performs tilde expansion, parameter and variable expansion, + arithmetic expansion, command substitution, and quote removal on associa- + tive array subscripts. Empty strings cannot be used as associative array keys. - BBaasshh automatically creates an indexed array if any variable is assigned to + BBaasshh automatically creates an indexed array if any variable is assigned to using the syntax _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e . - The _s_u_b_s_c_r_i_p_t is treated as an arithmetic expression that must evaluate to - a number greater than or equal to zero. To explicitly declare an indexed + The _s_u_b_s_c_r_i_p_t is treated as an arithmetic expression that must evaluate to + a number greater than or equal to zero. To explicitly declare an indexed array, use ddeeccllaarree --aa _n_a_m_e (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). @@ -1617,120 +1617,120 @@ PPAARRAAMMEETTEERRSS Associative arrays are created using ddeeccllaarree --AA _n_a_m_e . - Attributes may be specified for an array variable using the ddeeccllaarree and + Attributes may be specified for an array variable using the ddeeccllaarree and rreeaaddoonnllyy builtins. Each attribute applies to all members of an array. Arrays are assigned using compound assignments of the form _n_a_m_e=((value_1 ... - value_n)), where each _v_a_l_u_e may be of the form [_s_u_b_s_c_r_i_p_t]=_s_t_r_i_n_g. Indexed - array assignments do not require anything but _s_t_r_i_n_g. Each _v_a_l_u_e in the - list is expanded using the shell expansions described below under EEXXPPAANN-- + value_n)), where each _v_a_l_u_e may be of the form [_s_u_b_s_c_r_i_p_t]=_s_t_r_i_n_g. Indexed + array assignments do not require anything but _s_t_r_i_n_g. Each _v_a_l_u_e in the + list is expanded using the shell expansions described below under EEXXPPAANN-- SSIIOONN, but _v_a_l_u_es that are valid variable assignments including the brackets - and subscript do not undergo brace expansion and word splitting, as with + and subscript do not undergo brace expansion and word splitting, as with individual variable assignments. - When assigning to indexed arrays, if the optional brackets and subscript + When assigning to indexed arrays, if the optional brackets and subscript are supplied, that index is assigned to; otherwise the index of the element assigned is the last index assigned to by the statement plus one. Indexing starts at zero. - When assigning to an associative array, the words in a compound assignment - may be either assignment statements, for which the subscript is required, - or a list of words that is interpreted as a sequence of alternating keys - and values: _n_a_m_e=(( _k_e_y_1 _v_a_l_u_e_1 _k_e_y_2 _v_a_l_u_e_2 ...)). The first word in the + When assigning to an associative array, the words in a compound assignment + may be either assignment statements, for which the subscript is required, + or a list of words that is interpreted as a sequence of alternating keys + and values: _n_a_m_e=(( _k_e_y_1 _v_a_l_u_e_1 _k_e_y_2 _v_a_l_u_e_2 ...)). The first word in the list determines how the remaining words are interpreted; all assignments in - a list must be of the same type. When using key/value pairs, the keys may - not be missing or empty; a final missing value is treated like the empty + a list must be of the same type. When using key/value pairs, the keys may + not be missing or empty; a final missing value is treated like the empty string. - The kkvvppaaiirr__sspplliitt option to the sshhoopptt builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS - below) determines how the words in a key/value pair assignment list are - treated. If it is enabled, each word in the list undergoes word expan- - sions, including word splitting, before the assignment identifies individ- - ual keys and values. If it is unset, the key/value pairs in the example - above are treated identically to _n_a_m_e=(( [_k_e_y_1]=_v_a_l_u_e_1 [_k_e_y_2]=_v_a_l_u_e_2 ...)) + The kkvvppaaiirr__sspplliitt option to the sshhoopptt builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS + below) determines how the words in a key/value pair assignment list are + treated. If it is enabled, each word in the list undergoes word expan- + sions, including word splitting, before the assignment identifies individ- + ual keys and values. If it is unset, the key/value pairs in the example + above are treated identically to _n_a_m_e=(( [_k_e_y_1]=_v_a_l_u_e_1 [_k_e_y_2]=_v_a_l_u_e_2 ...)) and expanded appropriately. This syntax is also accepted by the ddeeccllaarree builtin. Individual array ele- - ments may be assigned to using the _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e syntax introduced + ments may be assigned to using the _n_a_m_e[_s_u_b_s_c_r_i_p_t]=_v_a_l_u_e syntax introduced above. - When assigning to an indexed array, if _n_a_m_e is subscripted by a negative + When assigning to an indexed array, if _n_a_m_e is subscripted by a negative number, that number is interpreted as relative to one greater than the max- - imum index of _n_a_m_e, so negative indices count back from the end of the ar- + imum index of _n_a_m_e, so negative indices count back from the end of the ar- ray, and an index of -1 references the last element. - The "+=" operator appends to an array variable when assigning using the + The "+=" operator appends to an array variable when assigning using the compound assignment syntax; see PPAARRAAMMEETTEERRSS above. - If one of the word expansions in a compound array assignment unsets the + If one of the word expansions in a compound array assignment unsets the variable, the results are unspecified. - An array element is referenced using ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. The braces are - required to avoid conflicts with pathname expansion. If _s_u_b_s_c_r_i_p_t is @@ or + An array element is referenced using ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. The braces are + required to avoid conflicts with pathname expansion. If _s_u_b_s_c_r_i_p_t is @@ or **, the word expands to all members of _n_a_m_e, unless noted in the description of a builtin or word expansion. These subscripts differ only when the word appears within double quotes. If the word is double-quoted, ${_n_a_m_e[*]} ex- pands to a single word with the value of each array member separated by the - first character of the IIFFSS special variable, and ${_n_a_m_e[@]} expands each - element of _n_a_m_e to a separate word. When there are no array members, - ${_n_a_m_e[@]} expands to nothing. If the double-quoted expansion occurs - within a word, the expansion of the first parameter is joined with the be- - ginning part of the expansion of the original word, and the expansion of - the last parameter is joined with the last part of the expansion of the - original word. This is analogous to the expansion of the special parame- + first character of the IIFFSS special variable, and ${_n_a_m_e[@]} expands each + element of _n_a_m_e to a separate word. When there are no array members, + ${_n_a_m_e[@]} expands to nothing. If the double-quoted expansion occurs + within a word, the expansion of the first parameter is joined with the be- + ginning part of the expansion of the original word, and the expansion of + the last parameter is joined with the last part of the expansion of the + original word. This is analogous to the expansion of the special parame- ters ** and @@ (see SSppeecciiaall PPaarraammeetteerrss above). - ${#_n_a_m_e[_s_u_b_s_c_r_i_p_t]} expands to the length of ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. If _s_u_b_- + ${#_n_a_m_e[_s_u_b_s_c_r_i_p_t]} expands to the length of ${_n_a_m_e[_s_u_b_s_c_r_i_p_t]}. If _s_u_b_- _s_c_r_i_p_t is ** or @@, the expansion is the number of elements in the array. If the _s_u_b_s_c_r_i_p_t used to reference an element of an indexed array evaluates - to a number less than zero, it is interpreted as relative to one greater - than the maximum index of the array, so negative indices count back from + to a number less than zero, it is interpreted as relative to one greater + than the maximum index of the array, so negative indices count back from the end of the array, and an index of -1 references the last element. - Referencing an array variable without a subscript is equivalent to refer- - encing the array with a subscript of 0. Any reference to a variable using + Referencing an array variable without a subscript is equivalent to refer- + encing the array with a subscript of 0. Any reference to a variable using a valid subscript is valid; bbaasshh creates an array if necessary. - An array variable is considered set if a subscript has been assigned a + An array variable is considered set if a subscript has been assigned a value. The null string is a valid value. It is possible to obtain the keys (indices) of an array as well as the val- - ues. ${!!_n_a_m_e[_@]} and ${!!_n_a_m_e[_*]} expand to the indices assigned in array - variable _n_a_m_e. The treatment when in double quotes is similar to the ex- + ues. ${!!_n_a_m_e[_@]} and ${!!_n_a_m_e[_*]} expand to the indices assigned in array + variable _n_a_m_e. The treatment when in double quotes is similar to the ex- pansion of the special parameters _@ and _* within double quotes. - The uunnsseett builtin is used to destroy arrays. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] unsets - the array element at index _s_u_b_s_c_r_i_p_t, for both indexed and associative ar- - rays. Negative subscripts to indexed arrays are interpreted as described - above. Unsetting the last element of an array variable does not unset the - variable. uunnsseett _n_a_m_e, where _n_a_m_e is an array, removes the entire array. - uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] behaves differently depending on whether _n_a_m_e is an + The uunnsseett builtin is used to destroy arrays. uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] unsets + the array element at index _s_u_b_s_c_r_i_p_t, for both indexed and associative ar- + rays. Negative subscripts to indexed arrays are interpreted as described + above. Unsetting the last element of an array variable does not unset the + variable. uunnsseett _n_a_m_e, where _n_a_m_e is an array, removes the entire array. + uunnsseett _n_a_m_e[_s_u_b_s_c_r_i_p_t] behaves differently depending on whether _n_a_m_e is an indexed or associative array when _s_u_b_s_c_r_i_p_t is ** or @@. If _n_a_m_e is an asso- - ciative array, this unsets the element with subscript ** or @@. If _n_a_m_e is + ciative array, this unsets the element with subscript ** or @@. If _n_a_m_e is an indexed array, unset removes all of the elements but does not remove the array itself. - When using a variable name with a subscript as an argument to a command, - such as with uunnsseett, without using the word expansion syntax described - above, (e.g., unset a[4]), the argument is subject to pathname expansion. - Quote the argument if pathname expansion is not desired (e.g., unset + When using a variable name with a subscript as an argument to a command, + such as with uunnsseett, without using the word expansion syntax described + above, (e.g., unset a[4]), the argument is subject to pathname expansion. + Quote the argument if pathname expansion is not desired (e.g., unset 'a[4]'). - The ddeeccllaarree, llooccaall, and rreeaaddoonnllyy builtins each accept a --aa option to spec- - ify an indexed array and a --AA option to specify an associative array. If + The ddeeccllaarree, llooccaall, and rreeaaddoonnllyy builtins each accept a --aa option to spec- + ify an indexed array and a --AA option to specify an associative array. If both options are supplied, --AA takes precedence. The rreeaadd builtin accepts a - --aa option to assign a list of words read from the standard input to an ar- - ray. The sseett and ddeeccllaarree builtins display array values in a way that al- - lows them to be reused as assignments. Other builtins accept array name - arguments as well (e.g., mmaappffiillee); see the descriptions of individual - builtins below for details. The shell provides a number of builtin array + --aa option to assign a list of words read from the standard input to an ar- + ray. The sseett and ddeeccllaarree builtins display array values in a way that al- + lows them to be reused as assignments. Other builtins accept array name + arguments as well (e.g., mmaappffiillee); see the descriptions of individual + builtins below for details. The shell provides a number of builtin array variables. EEXXPPAANNSSIIOONN - Expansion is performed on the command line after it has been split into - words. The shell performs these expansions: _b_r_a_c_e _e_x_p_a_n_s_i_o_n, _t_i_l_d_e _e_x_p_a_n_- - _s_i_o_n, _p_a_r_a_m_e_t_e_r _a_n_d _v_a_r_i_a_b_l_e _e_x_p_a_n_s_i_o_n, _c_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n, _a_r_i_t_h_m_e_t_i_c + Expansion is performed on the command line after it has been split into + words. The shell performs these expansions: _b_r_a_c_e _e_x_p_a_n_s_i_o_n, _t_i_l_d_e _e_x_p_a_n_- + _s_i_o_n, _p_a_r_a_m_e_t_e_r _a_n_d _v_a_r_i_a_b_l_e _e_x_p_a_n_s_i_o_n, _c_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n, _a_r_i_t_h_m_e_t_i_c _e_x_p_a_n_s_i_o_n, _w_o_r_d _s_p_l_i_t_t_i_n_g, _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, and _q_u_o_t_e _r_e_m_o_v_a_l. The order of expansions is: brace expansion; tilde expansion, parameter and @@ -1742,29 +1742,29 @@ EEXXPPAANNSSIIOONN _p_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n. This is performed at the same time as tilde, parame- ter, variable, and arithmetic expansion and command substitution. - _Q_u_o_t_e _r_e_m_o_v_a_l is always performed last. It removes quote characters - present in the original word, not ones resulting from one of the other ex- + _Q_u_o_t_e _r_e_m_o_v_a_l is always performed last. It removes quote characters + present in the original word, not ones resulting from one of the other ex- pansions, unless they have been quoted themselves. - Only brace expansion, word splitting, and pathname expansion can increase + Only brace expansion, word splitting, and pathname expansion can increase the number of words of the expansion; other expansions expand a single word - to a single word. The only exceptions to this are the expansions of ""$$@@"" - and ""$${{_n_a_m_e[[@@]]}}"", and, in most cases, $$** and $${{_n_a_m_e[[**]]}} as explained above + to a single word. The only exceptions to this are the expansions of ""$$@@"" + and ""$${{_n_a_m_e[[@@]]}}"", and, in most cases, $$** and $${{_n_a_m_e[[**]]}} as explained above (see PPAARRAAMMEETTEERRSS). BBrraaccee EExxppaannssiioonn _B_r_a_c_e _e_x_p_a_n_s_i_o_n is a mechanism to generate arbitrary strings sharing a com- - mon prefix and suffix, either of which can be empty. This mechanism is - similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the filenames generated need not exist. - Patterns to be brace expanded are formed from an optional _p_r_e_a_m_b_l_e, fol- - lowed by either a series of comma-separated strings or a sequence expres- - sion between a pair of braces, followed by an optional _p_o_s_t_s_c_r_i_p_t. The - preamble is prefixed to each string contained within the braces, and the - postscript is then appended to each resulting string, expanding left to + mon prefix and suffix, either of which can be empty. This mechanism is + similar to _p_a_t_h_n_a_m_e _e_x_p_a_n_s_i_o_n, but the filenames generated need not exist. + Patterns to be brace expanded are formed from an optional _p_r_e_a_m_b_l_e, fol- + lowed by either a series of comma-separated strings or a sequence expres- + sion between a pair of braces, followed by an optional _p_o_s_t_s_c_r_i_p_t. The + preamble is prefixed to each string contained within the braces, and the + postscript is then appended to each resulting string, expanding left to right. - Brace expansions may be nested. The results of each expanded string are - not sorted; brace expansion preserves left to right order. For example, + Brace expansions may be nested. The results of each expanded string are + not sorted; brace expansion preserves left to right order. For example, a{{d,c,b}}e expands into "ade ace abe". A sequence expression takes the form _x...._y[[...._i_n_c_r]], where _x and _y are either @@ -1773,23 +1773,23 @@ EEXXPPAANNSSIIOONN and _y, inclusive. If either _x or _y begins with a zero, each generated term will contain the same number of digits, zero-padding where necessary. When letters are supplied, the expression expands to each character lexicograph- - ically between _x and _y, inclusive, using the C locale. Note that both _x - and _y must be of the same type (integer or letter). When the increment is - supplied, it is used as the difference between each term. The default in- + ically between _x and _y, inclusive, using the C locale. Note that both _x + and _y must be of the same type (integer or letter). When the increment is + supplied, it is used as the difference between each term. The default in- crement is 1 or -1 as appropriate. - Brace expansion is performed before any other expansions, and any charac- - ters special to other expansions are preserved in the result. It is - strictly textual. BBaasshh does not apply any syntactic interpretation to the + Brace expansion is performed before any other expansions, and any charac- + ters special to other expansions are preserved in the result. It is + strictly textual. BBaasshh does not apply any syntactic interpretation to the context of the expansion or the text between the braces. - A correctly-formed brace expansion must contain unquoted opening and clos- + A correctly-formed brace expansion must contain unquoted opening and clos- ing braces, and at least one unquoted comma or a valid sequence expression. Any incorrectly formed brace expansion is left unchanged. A "{" or Q , may be quoted with a backslash to prevent its being considered - part of a brace expression. To avoid conflicts with parameter expansion, - the string "${" is not considered eligible for brace expansion, and in- + part of a brace expression. To avoid conflicts with parameter expansion, + the string "${" is not considered eligible for brace expansion, and in- hibits brace expansion until the closing "}". This construct is typically used as shorthand when the common prefix of the @@ -1799,62 +1799,62 @@ EEXXPPAANNSSIIOONN or chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}} - Brace expansion introduces a slight incompatibility with historical ver- - sions of sshh. sshh does not treat opening or closing braces specially when - they appear as part of a word, and preserves them in the output. BBaasshh re- - moves braces from words as a consequence of brace expansion. For example, - a word entered to sshh as "file{1,2}" appears identically in the output. - BBaasshh outputs that word as "file1 file2" after brace expansion. Start bbaasshh + Brace expansion introduces a slight incompatibility with historical ver- + sions of sshh. sshh does not treat opening or closing braces specially when + they appear as part of a word, and preserves them in the output. BBaasshh re- + moves braces from words as a consequence of brace expansion. For example, + a word entered to sshh as "file{1,2}" appears identically in the output. + BBaasshh outputs that word as "file1 file2" after brace expansion. Start bbaasshh with the ++BB option or disable brace expansion with the ++BB option to the sseett command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) for strict sshh compatibility. TTiillddee EExxppaannssiioonn If a word begins with an unquoted tilde character ("~~"), all of the charac- - ters preceding the first unquoted slash (or all characters, if there is no - unquoted slash) are considered a _t_i_l_d_e_-_p_r_e_f_i_x. If none of the characters - in the tilde-prefix are quoted, the characters in the tilde-prefix follow- - ing the tilde are treated as a possible _l_o_g_i_n _n_a_m_e. If this login name is - the null string, the tilde is replaced with the value of the shell parame- + ters preceding the first unquoted slash (or all characters, if there is no + unquoted slash) are considered a _t_i_l_d_e_-_p_r_e_f_i_x. If none of the characters + in the tilde-prefix are quoted, the characters in the tilde-prefix follow- + ing the tilde are treated as a possible _l_o_g_i_n _n_a_m_e. If this login name is + the null string, the tilde is replaced with the value of the shell parame- ter HHOOMMEE. If HHOOMMEE is unset, the tilde expands to the home directory of the - user executing the shell instead. Otherwise, the tilde-prefix is replaced + user executing the shell instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name. If the tilde-prefix is a "~+", the value of the shell variable PPWWDD replaces the tilde-prefix. If the tilde-prefix is a "~-", the shell substitutes the - value of the shell variable OOLLDDPPWWDD, if it is set. If the characters fol- + value of the shell variable OOLLDDPPWWDD, if it is set. If the characters fol- lowing the tilde in the tilde-prefix consist of a number _N, optionally pre- - fixed by a "+" or a "-", the tilde-prefix is replaced with the correspond- - ing element from the directory stack, as it would be displayed by the ddiirrss + fixed by a "+" or a "-", the tilde-prefix is replaced with the correspond- + ing element from the directory stack, as it would be displayed by the ddiirrss builtin invoked with the characters following the tilde in the tilde-prefix - as an argument. If the characters following the tilde in the tilde-prefix - consist of a number without a leading "+" or "-", tilde expansion assumes + as an argument. If the characters following the tilde in the tilde-prefix + consist of a number without a leading "+" or "-", tilde expansion assumes "+". - The results of tilde expansion are treated as if they were quoted, so the + The results of tilde expansion are treated as if they were quoted, so the replacement is not subject to word splitting and pathname expansion. - If the login name is invalid, or the tilde expansion fails, the tilde-pre- + If the login name is invalid, or the tilde expansion fails, the tilde-pre- fix is unchanged. - BBaasshh checks each variable assignment for unquoted tilde-prefixes immedi- - ately following a :: or the first ==, and performs tilde expansion in these - cases. Consequently, one may use filenames with tildes in assignments to + BBaasshh checks each variable assignment for unquoted tilde-prefixes immedi- + ately following a :: or the first ==, and performs tilde expansion in these + cases. Consequently, one may use filenames with tildes in assignments to PPAATTHH, MMAAIILLPPAATTHH, and CCDDPPAATTHH, and the shell assigns the expanded value. - BBaasshh also performs tilde expansion on words satisfying the conditions of + BBaasshh also performs tilde expansion on words satisfying the conditions of variable assignments (as described above under PPAARRAAMMEETTEERRSS) when they appear as arguments to simple commands. BBaasshh does not do this, except for the _d_e_- _c_l_a_r_a_t_i_o_n commands listed above, when in posix mode. PPaarraammeetteerr EExxppaannssiioonn - The "$$" character introduces parameter expansion, command substitution, or - arithmetic expansion. The parameter name or symbol to be expanded may be + The "$$" character introduces parameter expansion, command substitution, or + arithmetic expansion. The parameter name or symbol to be expanded may be enclosed in braces, which are optional but serve to protect the variable to - be expanded from characters immediately following it which could be inter- + be expanded from characters immediately following it which could be inter- preted as part of the name. - When braces are used, the matching ending brace is the first "}}" not es- - caped by a backslash or within a quoted string, and not within an embedded + When braces are used, the matching ending brace is the first "}}" not es- + caped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion. The basic form of parameter expansion is @@ -1863,24 +1863,24 @@ EEXXPPAANNSSIIOONN which substitutes the value of _p_a_r_a_m_e_t_e_r. The braces are required when _p_a_- _r_a_m_e_t_e_r is a positional parameter with more than one digit, or when _p_a_r_a_m_e_- - _t_e_r is followed by a character which is not to be interpreted as part of - its name. The _p_a_r_a_m_e_t_e_r is a shell parameter as described above (PPAARRAAMMEE-- + _t_e_r is followed by a character which is not to be interpreted as part of + its name. The _p_a_r_a_m_e_t_e_r is a shell parameter as described above (PPAARRAAMMEE-- TTEERRSS) or an array reference (AArrrraayyss). - If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point (!!), and _p_a_r_a_- - _m_e_t_e_r is not a _n_a_m_e_r_e_f, it introduces a level of indirection. BBaasshh uses - the value formed by expanding the rest of _p_a_r_a_m_e_t_e_r as the new _p_a_r_a_m_e_t_e_r; - this new parameter is then expanded and that value is used in the rest of - the expansion, rather than the expansion of the original _p_a_r_a_m_e_t_e_r. This - is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The value is subject to tilde expansion, - parameter expansion, command substitution, and arithmetic expansion. If - _p_a_r_a_m_e_t_e_r is a nameref, this expands to the name of the parameter refer- - enced by _p_a_r_a_m_e_t_e_r instead of performing the complete indirect expansion, - for compatibility. The exceptions to this are the expansions of ${!!_p_r_e_- - _f_i_x**} and ${!!_n_a_m_e[_@]} described below. The exclamation point must immedi- + If the first character of _p_a_r_a_m_e_t_e_r is an exclamation point (!!), and _p_a_r_a_- + _m_e_t_e_r is not a _n_a_m_e_r_e_f, it introduces a level of indirection. BBaasshh uses + the value formed by expanding the rest of _p_a_r_a_m_e_t_e_r as the new _p_a_r_a_m_e_t_e_r; + this new parameter is then expanded and that value is used in the rest of + the expansion, rather than the expansion of the original _p_a_r_a_m_e_t_e_r. This + is known as _i_n_d_i_r_e_c_t _e_x_p_a_n_s_i_o_n. The value is subject to tilde expansion, + parameter expansion, command substitution, and arithmetic expansion. If + _p_a_r_a_m_e_t_e_r is a nameref, this expands to the name of the parameter refer- + enced by _p_a_r_a_m_e_t_e_r instead of performing the complete indirect expansion, + for compatibility. The exceptions to this are the expansions of ${!!_p_r_e_- + _f_i_x**} and ${!!_n_a_m_e[_@]} described below. The exclamation point must immedi- ately follow the left brace in order to introduce indirection. - In each of the cases below, _w_o_r_d is subject to tilde expansion, parameter + In each of the cases below, _w_o_r_d is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. When performing the first four expansions documented below (::--, ::==, ::??, and @@ -1888,181 +1888,181 @@ EEXXPPAANNSSIIOONN Omitting the colon tests only for a parameter that is unset. ${_p_a_r_a_m_e_t_e_r::--_w_o_r_d} - UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if the - colon is not present, the expansion of _w_o_r_d is substituted. Other- + UUssee DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if the + colon is not present, the expansion of _w_o_r_d is substituted. Other- wise, the value of _p_a_r_a_m_e_t_e_r is substituted. ${_p_a_r_a_m_e_t_e_r::==_w_o_r_d} - AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if + AAssssiiggnn DDeeffaauulltt VVaalluueess. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if the colon is not present, the expansion of _w_o_r_d is assigned to _p_a_r_a_- - _m_e_t_e_r, and the expansion is the final value of _p_a_r_a_m_e_t_e_r. Posi- + _m_e_t_e_r, and the expansion is the final value of _p_a_r_a_m_e_t_e_r. Posi- tional parameters and special parameters may not be assigned in this way. ${_p_a_r_a_m_e_t_e_r::??_w_o_r_d} - DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is unset or null, or + DDiissppllaayy EErrrroorr iiff NNuullll oorr UUnnsseett. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if the colon is not present, the shell writes the expansion of - _w_o_r_d (or a message to that effect if _w_o_r_d is not present) to the - standard error and, if it is not interactive, exits with a non-zero - status. An interactive shell does not exit, but does not execute - the command associated with the expansion. Otherwise, the value of + _w_o_r_d (or a message to that effect if _w_o_r_d is not present) to the + standard error and, if it is not interactive, exits with a non-zero + status. An interactive shell does not exit, but does not execute + the command associated with the expansion. Otherwise, the value of _p_a_r_a_m_e_t_e_r is substituted. ${_p_a_r_a_m_e_t_e_r::++_w_o_r_d} UUssee AAlltteerrnnaattee VVaalluuee. If _p_a_r_a_m_e_t_e_r is unset or null, or unset if the - colon is not present, nothing is substituted, otherwise the expan- + colon is not present, nothing is substituted, otherwise the expan- sion of _w_o_r_d is substituted. The value of _p_a_r_a_m_e_t_e_r is not used. ${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t} ${_p_a_r_a_m_e_t_e_r::_o_f_f_s_e_t::_l_e_n_g_t_h} - SSuubbssttrriinngg EExxppaannssiioonn. Expands to up to _l_e_n_g_t_h characters of the - value of _p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_s_e_t. - If _p_a_r_a_m_e_t_e_r is @@ or **, an indexed array subscripted by @@ or **, or - an associative array name, the results differ as described below. - If ::_l_e_n_g_t_h is omitted (the first form above), this expands to the + SSuubbssttrriinngg EExxppaannssiioonn. Expands to up to _l_e_n_g_t_h characters of the + value of _p_a_r_a_m_e_t_e_r starting at the character specified by _o_f_f_s_e_t. + If _p_a_r_a_m_e_t_e_r is @@ or **, an indexed array subscripted by @@ or **, or + an associative array name, the results differ as described below. + If ::_l_e_n_g_t_h is omitted (the first form above), this expands to the substring of the value of _p_a_r_a_m_e_t_e_r starting at the character speci- - fied by _o_f_f_s_e_t and extending to the end of the value. If _o_f_f_s_e_t is - omitted, it is treated as 0. If _l_e_n_g_t_h is omitted, but the colon - after _o_f_f_s_e_t is present, it is treated as 0. _l_e_n_g_t_h and _o_f_f_s_e_t are + fied by _o_f_f_s_e_t and extending to the end of the value. If _o_f_f_s_e_t is + omitted, it is treated as 0. If _l_e_n_g_t_h is omitted, but the colon + after _o_f_f_s_e_t is present, it is treated as 0. _l_e_n_g_t_h and _o_f_f_s_e_t are arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN below). If _o_f_f_s_e_t evaluates to a number less than zero, the value is used as - an offset in characters from the end of the value of _p_a_r_a_m_e_t_e_r. If + an offset in characters from the end of the value of _p_a_r_a_m_e_t_e_r. If _l_e_n_g_t_h evaluates to a number less than zero, it is interpreted as an - offset in characters from the end of the value of _p_a_r_a_m_e_t_e_r rather + offset in characters from the end of the value of _p_a_r_a_m_e_t_e_r rather than a number of characters, and the expansion is the characters be- - tween _o_f_f_s_e_t and that result. Note that a negative offset must be - separated from the colon by at least one space to avoid being con- + tween _o_f_f_s_e_t and that result. Note that a negative offset must be + separated from the colon by at least one space to avoid being con- fused with the ::-- expansion. - If _p_a_r_a_m_e_t_e_r is @@ or **, the result is _l_e_n_g_t_h positional parameters - beginning at _o_f_f_s_e_t. A negative _o_f_f_s_e_t is taken relative to one - greater than the greatest positional parameter, so an offset of -1 + If _p_a_r_a_m_e_t_e_r is @@ or **, the result is _l_e_n_g_t_h positional parameters + beginning at _o_f_f_s_e_t. A negative _o_f_f_s_e_t is taken relative to one + greater than the greatest positional parameter, so an offset of -1 evaluates to the last positional parameter (or 0 if there are no po- - sitional parameters). It is an expansion error if _l_e_n_g_t_h evaluates + sitional parameters). It is an expansion error if _l_e_n_g_t_h evaluates to a number less than zero. If _p_a_r_a_m_e_t_e_r is an indexed array name subscripted by @ or *, the re- - sult is the _l_e_n_g_t_h members of the array beginning with ${_p_a_r_a_m_e_- - _t_e_r[_o_f_f_s_e_t]}. A negative _o_f_f_s_e_t is taken relative to one greater - than the maximum index of the specified array. It is an expansion + sult is the _l_e_n_g_t_h members of the array beginning with ${_p_a_r_a_m_e_- + _t_e_r[_o_f_f_s_e_t]}. A negative _o_f_f_s_e_t is taken relative to one greater + than the maximum index of the specified array. It is an expansion error if _l_e_n_g_t_h evaluates to a number less than zero. - Substring expansion applied to an associative array produces unde- + Substring expansion applied to an associative array produces unde- fined results. - Substring indexing is zero-based unless the positional parameters - are used, in which case the indexing starts at 1 by default. If - _o_f_f_s_e_t is 0, and the positional parameters are used, $$00 is prefixed + Substring indexing is zero-based unless the positional parameters + are used, in which case the indexing starts at 1 by default. If + _o_f_f_s_e_t is 0, and the positional parameters are used, $$00 is prefixed to the list. ${!!_p_r_e_f_i_x**} ${!!_p_r_e_f_i_x@@} - NNaammeess mmaattcchhiinngg pprreeffiixx. Expands to the names of variables whose + NNaammeess mmaattcchhiinngg pprreeffiixx. Expands to the names of variables whose names begin with _p_r_e_f_i_x, separated by the first character of the IIFFSS - special variable. When _@ is used and the expansion appears within + special variable. When _@ is used and the expansion appears within double quotes, each variable name expands to a separate word. ${!!_n_a_m_e[_@]} ${!!_n_a_m_e[_*]} - LLiisstt ooff aarrrraayy kkeeyyss. If _n_a_m_e is an array variable, expands to the - list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is not an - array, expands to 0 if _n_a_m_e is set and null otherwise. When _@ is - used and the expansion appears within double quotes, each key ex- + LLiisstt ooff aarrrraayy kkeeyyss. If _n_a_m_e is an array variable, expands to the + list of array indices (keys) assigned in _n_a_m_e. If _n_a_m_e is not an + array, expands to 0 if _n_a_m_e is set and null otherwise. When _@ is + used and the expansion appears within double quotes, each key ex- pands to a separate word. ${##_p_a_r_a_m_e_t_e_r} - PPaarraammeetteerr lleennggtthh. Substitutes the length in characters of the ex- - panded value of _p_a_r_a_m_e_t_e_r. If _p_a_r_a_m_e_t_e_r is ** or @@, the value sub- + PPaarraammeetteerr lleennggtthh. Substitutes the length in characters of the ex- + panded value of _p_a_r_a_m_e_t_e_r. If _p_a_r_a_m_e_t_e_r is ** or @@, the value sub- stituted is the number of positional parameters. If _p_a_r_a_m_e_t_e_r is an - array name subscripted by ** or @@, the value substituted is the num- + array name subscripted by ** or @@, the value substituted is the num- ber of elements in the array. If _p_a_r_a_m_e_t_e_r is an indexed array name subscripted by a negative number, that number is interpreted as rel- - ative to one greater than the maximum index of _p_a_r_a_m_e_t_e_r, so nega- - tive indices count back from the end of the array, and an index of + ative to one greater than the maximum index of _p_a_r_a_m_e_t_e_r, so nega- + tive indices count back from the end of the array, and an index of -1 references the last element. ${_p_a_r_a_m_e_t_e_r##_w_o_r_d} ${_p_a_r_a_m_e_t_e_r####_w_o_r_d} - RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce a - pattern just as in pathname expansion, and matched against the ex- - panded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatttteerrnn - MMaattcchhiinngg below. If the pattern matches the beginning of the value + RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce a + pattern just as in pathname expansion, and matched against the ex- + panded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatttteerrnn + MMaattcchhiinngg below. If the pattern matches the beginning of the value of _p_a_r_a_m_e_t_e_r, then the result of the expansion is the expanded value - of _p_a_r_a_m_e_t_e_r with the shortest matching pattern (the "#" case) or - the longest matching pattern (the "##" case) deleted. If _p_a_r_a_m_e_t_e_r - is @@ or **, the pattern removal operation is applied to each posi- - tional parameter in turn, and the expansion is the resultant list. - If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or **, the pat- - tern removal operation is applied to each member of the array in + of _p_a_r_a_m_e_t_e_r with the shortest matching pattern (the "#" case) or + the longest matching pattern (the "##" case) deleted. If _p_a_r_a_m_e_t_e_r + is @@ or **, the pattern removal operation is applied to each posi- + tional parameter in turn, and the expansion is the resultant list. + If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or **, the pat- + tern removal operation is applied to each member of the array in turn, and the expansion is the resultant list. ${_p_a_r_a_m_e_t_e_r%%_w_o_r_d} ${_p_a_r_a_m_e_t_e_r%%%%_w_o_r_d} - RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce a - pattern just as in pathname expansion, and matched against the ex- - panded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatttteerrnn - MMaattcchhiinngg below. If the pattern matches a trailing portion of the + RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn. The _w_o_r_d is expanded to produce a + pattern just as in pathname expansion, and matched against the ex- + panded value of _p_a_r_a_m_e_t_e_r using the rules described under PPaatttteerrnn + MMaattcchhiinngg below. If the pattern matches a trailing portion of the expanded value of _p_a_r_a_m_e_t_e_r, then the result of the expansion is the - expanded value of _p_a_r_a_m_e_t_e_r with the shortest matching pattern (the - "%" case) or the longest matching pattern (the "%%" case) deleted. - If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern removal operation is applied to - each positional parameter in turn, and the expansion is the resul- - tant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or - **, the pattern removal operation is applied to each member of the + expanded value of _p_a_r_a_m_e_t_e_r with the shortest matching pattern (the + "%" case) or the longest matching pattern (the "%%" case) deleted. + If _p_a_r_a_m_e_t_e_r is @@ or **, the pattern removal operation is applied to + each positional parameter in turn, and the expansion is the resul- + tant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or + **, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list. ${_p_a_r_a_m_e_t_e_r//_p_a_t_t_e_r_n//_s_t_r_i_n_g} ${_p_a_r_a_m_e_t_e_r////_p_a_t_t_e_r_n//_s_t_r_i_n_g} ${_p_a_r_a_m_e_t_e_r//##_p_a_t_t_e_r_n//_s_t_r_i_n_g} ${_p_a_r_a_m_e_t_e_r//%%_p_a_t_t_e_r_n//_s_t_r_i_n_g} - PPaatttteerrnn ssuubbssttiittuuttiioonn. The _p_a_t_t_e_r_n is expanded to produce a pattern + PPaatttteerrnn ssuubbssttiittuuttiioonn. The _p_a_t_t_e_r_n is expanded to produce a pattern and matched against the expanded value of _p_a_r_a_m_e_t_e_r as described un- der PPaatttteerrnn MMaattcchhiinngg below. The longest match of _p_a_t_t_e_r_n in the ex- panded value is replaced with _s_t_r_i_n_g. _s_t_r_i_n_g undergoes tilde expan- - sion, parameter and variable expansion, arithmetic expansion, com- + sion, parameter and variable expansion, arithmetic expansion, com- mand and process substitution, and quote removal. In the first form above, only the first match is replaced. If there - are two slashes separating _p_a_r_a_m_e_t_e_r and _p_a_t_t_e_r_n (the second form + are two slashes separating _p_a_r_a_m_e_t_e_r and _p_a_t_t_e_r_n (the second form above), all matches of _p_a_t_t_e_r_n are replaced with _s_t_r_i_n_g. If _p_a_t_t_e_r_n is preceded by ## (the third form above), it must match at the begin- - ning of the expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_t_t_e_r_n is preceded by - %% (the fourth form above), it must match at the end of the expanded + ning of the expanded value of _p_a_r_a_m_e_t_e_r. If _p_a_t_t_e_r_n is preceded by + %% (the fourth form above), it must match at the end of the expanded value of _p_a_r_a_m_e_t_e_r. - If the expansion of _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted + If the expansion of _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted and the // following _p_a_t_t_e_r_n may be omitted. - If the ppaattssuubb__rreeppllaacceemmeenntt shell option is enabled using sshhoopptt, any - unquoted instances of && in _s_t_r_i_n_g are replaced with the matching + If the ppaattssuubb__rreeppllaacceemmeenntt shell option is enabled using sshhoopptt, any + unquoted instances of && in _s_t_r_i_n_g are replaced with the matching portion of _p_a_t_t_e_r_n. - Quoting any part of _s_t_r_i_n_g inhibits replacement in the expansion of - the quoted portion, including replacement strings stored in shell - variables. Backslash escapes && in _s_t_r_i_n_g; the backslash is removed + Quoting any part of _s_t_r_i_n_g inhibits replacement in the expansion of + the quoted portion, including replacement strings stored in shell + variables. Backslash escapes && in _s_t_r_i_n_g; the backslash is removed in order to permit a literal && in the replacement string. Backslash - can also be used to escape a backslash; \\\\ results in a literal - backslash in the replacement. Users should take care if _s_t_r_i_n_g is - double-quoted to avoid unwanted interactions between the backslash - and double-quoting, since backslash has special meaning within dou- - ble quotes. Pattern substitution performs the check for unquoted && - after expanding _s_t_r_i_n_g; shell programmers should quote any occur- - rences of && they want to be taken literally in the replacement and + can also be used to escape a backslash; \\\\ results in a literal + backslash in the replacement. Users should take care if _s_t_r_i_n_g is + double-quoted to avoid unwanted interactions between the backslash + and double-quoting, since backslash has special meaning within dou- + ble quotes. Pattern substitution performs the check for unquoted && + after expanding _s_t_r_i_n_g; shell programmers should quote any occur- + rences of && they want to be taken literally in the replacement and ensure any instances of && they want to be replaced are unquoted. - Like the pattern removal operators, double quotes surrounding the - replacement string quote the expanded characters, while double + Like the pattern removal operators, double quotes surrounding the + replacement string quote the expanded characters, while double quotes enclosing the entire parameter substitution do not, since the - expansion is performed in a context that doesn't take any enclosing + expansion is performed in a context that doesn't take any enclosing double quotes into account. - If the nnooccaasseemmaattcchh shell option is enabled, the match is performed + If the nnooccaasseemmaattcchh shell option is enabled, the match is performed without regard to the case of alphabetic characters. - If _p_a_r_a_m_e_t_e_r is @@ or **, the substitution operation is applied to - each positional parameter in turn, and the expansion is the resul- - tant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or + If _p_a_r_a_m_e_t_e_r is @@ or **, the substitution operation is applied to + each positional parameter in turn, and the expansion is the resul- + tant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ or **, the substitution operation is applied to each member of the array in turn, and the expansion is the resultant list. @@ -2070,43 +2070,43 @@ EEXXPPAANNSSIIOONN ${_p_a_r_a_m_e_t_e_r^^^^_p_a_t_t_e_r_n} ${_p_a_r_a_m_e_t_e_r,,_p_a_t_t_e_r_n} ${_p_a_r_a_m_e_t_e_r,,,,_p_a_t_t_e_r_n} - CCaassee mmooddiiffiiccaattiioonn. This expansion modifies the case of alphabetic - characters in _p_a_r_a_m_e_t_e_r. First, the _p_a_t_t_e_r_n is expanded to produce - a pattern as described below under PPaatttteerrnn MMaattcchhiinngg. BBaasshh then ex- + CCaassee mmooddiiffiiccaattiioonn. This expansion modifies the case of alphabetic + characters in _p_a_r_a_m_e_t_e_r. First, the _p_a_t_t_e_r_n is expanded to produce + a pattern as described below under PPaatttteerrnn MMaattcchhiinngg. BBaasshh then ex- amines characters in the expanded value of _p_a_r_a_m_e_t_e_r against _p_a_t_t_e_r_n as described below. If a character matches the pattern, its case is - converted. The pattern should not attempt to match more than one + converted. The pattern should not attempt to match more than one character. - Using "^" converts lowercase letters matching _p_a_t_t_e_r_n to uppercase; - "," converts matching uppercase letters to lowercase. The ^^ and ,, - variants examine the first character in the expanded value and con- - vert its case if it matches _p_a_t_t_e_r_n; the ^^^^ and ,,,, variants examine - all characters in the expanded value and convert each one that - matches _p_a_t_t_e_r_n. If _p_a_t_t_e_r_n is omitted, it is treated like a ??, + Using "^" converts lowercase letters matching _p_a_t_t_e_r_n to uppercase; + "," converts matching uppercase letters to lowercase. The ^^ and ,, + variants examine the first character in the expanded value and con- + vert its case if it matches _p_a_t_t_e_r_n; the ^^^^ and ,,,, variants examine + all characters in the expanded value and convert each one that + matches _p_a_t_t_e_r_n. If _p_a_t_t_e_r_n is omitted, it is treated like a ??, which matches every character. - If _p_a_r_a_m_e_t_e_r is @@ or **, the case modification operation is applied - to each positional parameter in turn, and the expansion is the re- - sultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ - or **, the case modification operation is applied to each member of + If _p_a_r_a_m_e_t_e_r is @@ or **, the case modification operation is applied + to each positional parameter in turn, and the expansion is the re- + sultant list. If _p_a_r_a_m_e_t_e_r is an array variable subscripted with @@ + or **, the case modification operation is applied to each member of the array in turn, and the expansion is the resultant list. ${_p_a_r_a_m_e_t_e_r@@_o_p_e_r_a_t_o_r} - PPaarraammeetteerr ttrraannssffoorrmmaattiioonn. The expansion is either a transformation + PPaarraammeetteerr ttrraannssffoorrmmaattiioonn. The expansion is either a transformation of the value of _p_a_r_a_m_e_t_e_r or information about _p_a_r_a_m_e_t_e_r itself, de- pending on the value of _o_p_e_r_a_t_o_r. Each _o_p_e_r_a_t_o_r is a single letter: UU The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r with lowercase alphabetic characters converted to uppercase. uu The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r with - the first character converted to uppercase, if it is alpha- + the first character converted to uppercase, if it is alpha- betic. LL The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r with uppercase alphabetic characters converted to lowercase. - QQ The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r + QQ The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r quoted in a format that can be reused as input. EE The expansion is a string that is the value of _p_a_r_a_m_e_t_e_r with - backslash escape sequences expanded as with the $$''...'' quot- + backslash escape sequences expanded as with the $$''...'' quot- ing mechanism. PP The expansion is a string that is the result of expanding the value of _p_a_r_a_m_e_t_e_r as if it were a prompt string (see PPRROOMMPPTT-- @@ -2115,43 +2115,43 @@ EEXXPPAANNSSIIOONN ment or ddeeccllaarree command that, if evaluated, recreates _p_a_r_a_m_e_- _t_e_r with its attributes and value. KK Produces a possibly-quoted version of the value of _p_a_r_a_m_e_t_e_r, - except that it prints the values of indexed and associative - arrays as a sequence of quoted key-value pairs (see AArrrraayyss - above). The keys and values are quoted in a format that can + except that it prints the values of indexed and associative + arrays as a sequence of quoted key-value pairs (see AArrrraayyss + above). The keys and values are quoted in a format that can be reused as input. - aa The expansion is a string consisting of flag values repre- + aa The expansion is a string consisting of flag values repre- senting _p_a_r_a_m_e_t_e_r's attributes. kk Like the K transformation, but expands the keys and values of - indexed and associative arrays to separate words after word + indexed and associative arrays to separate words after word splitting. - If _p_a_r_a_m_e_t_e_r is @@ or **, the operation is applied to each positional - parameter in turn, and the expansion is the resultant list. If _p_a_- - _r_a_m_e_t_e_r is an array variable subscripted with @@ or **, the operation + If _p_a_r_a_m_e_t_e_r is @@ or **, the operation is applied to each positional + parameter in turn, and the expansion is the resultant list. If _p_a_- + _r_a_m_e_t_e_r is an array variable subscripted with @@ or **, the operation is applied to each member of the array in turn, and the expansion is the resultant list. - The result of the expansion is subject to word splitting and path- + The result of the expansion is subject to word splitting and path- name expansion as described below. CCoommmmaanndd SSuubbssttiittuuttiioonn - _C_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n allows the output of a command to replace the command + _C_o_m_m_a_n_d _s_u_b_s_t_i_t_u_t_i_o_n allows the output of a command to replace the command itself. There are two standard forms: $$((_c_o_m_m_a_n_d)) or (deprecated) ``_c_o_m_m_a_n_d``. - BBaasshh performs the expansion by executing _c_o_m_m_a_n_d in a subshell environment + BBaasshh performs the expansion by executing _c_o_m_m_a_n_d in a subshell environment and replacing the command substitution with the standard output of the com- - mand, with any trailing newlines deleted. Embedded newlines are not - deleted, but they may be removed during word splitting. The command sub- - stitution $$((ccaatt _f_i_l_e)) can be replaced by the equivalent but faster $$((<< + mand, with any trailing newlines deleted. Embedded newlines are not + deleted, but they may be removed during word splitting. The command sub- + stitution $$((ccaatt _f_i_l_e)) can be replaced by the equivalent but faster $$((<< _f_i_l_e)). - With the old-style backquote form of substitution, backslash retains its - literal meaning except when followed by $$, ``, or \\. The first backquote - not preceded by a backslash terminates the command substitution. When us- + With the old-style backquote form of substitution, backslash retains its + literal meaning except when followed by $$, ``, or \\. The first backquote + not preceded by a backslash terminates the command substitution. When us- ing the $(_c_o_m_m_a_n_d) form, all characters between the parentheses make up the command; none are treated specially. @@ -2159,23 +2159,23 @@ EEXXPPAANNSSIIOONN $${{_c _c_o_m_m_a_n_d;;}} - which executes _c_o_m_m_a_n_d in the current execution environment and captures + which executes _c_o_m_m_a_n_d in the current execution environment and captures its output, again with trailing newlines removed. - The character _c following the open brace must be a space, tab, newline, - "|", or ";"; and the close brace must be in a position where a reserved + The character _c following the open brace must be a space, tab, newline, + "|", or ";"; and the close brace must be in a position where a reserved word may appear (i.e., preceded by a command terminator such as semicolon). BBaasshh allows the close brace to be joined to the remaining characters in the - word without being followed by a shell metacharacter as a reserved word + word without being followed by a shell metacharacter as a reserved word would usually require. - Any side effects of _c_o_m_m_a_n_d take effect immediately in the current execu- - tion environment and persist in the current environment after the command + Any side effects of _c_o_m_m_a_n_d take effect immediately in the current execu- + tion environment and persist in the current environment after the command completes (e.g., the eexxiitt builtin exits the shell). - This type of command substitution superficially resembles executing an un- - named shell function: local variables are created as when a shell function - is executing, and the rreettuurrnn builtin forces _c_o_m_m_a_n_d to complete; however, + This type of command substitution superficially resembles executing an un- + named shell function: local variables are created as when a shell function + is executing, and the rreettuurrnn builtin forces _c_o_m_m_a_n_d to complete; however, the rest of the execution environment, including the positional parameters, is shared with the caller. @@ -2186,17 +2186,17 @@ EEXXPPAANNSSIIOONN put. If the first character following the open brace is a "|", the construct ex- - pands to the value of the RREEPPLLYY shell variable after _c_o_m_m_a_n_d executes, - without removing any trailing newlines, and the standard output of _c_o_m_m_a_n_d - remains the same as in the calling shell. BBaasshh creates RREEPPLLYY as an ini- - tially-unset local variable when _c_o_m_m_a_n_d executes, and restores RREEPPLLYY to - the value it had before the command substitution after _c_o_m_m_a_n_d completes, + pands to the value of the RREEPPLLYY shell variable after _c_o_m_m_a_n_d executes, + without removing any trailing newlines, and the standard output of _c_o_m_m_a_n_d + remains the same as in the calling shell. BBaasshh creates RREEPPLLYY as an ini- + tially-unset local variable when _c_o_m_m_a_n_d executes, and restores RREEPPLLYY to + the value it had before the command substitution after _c_o_m_m_a_n_d completes, as with any local variable. - Command substitutions may be nested. To nest when using the backquoted + Command substitutions may be nested. To nest when using the backquoted form, escape the inner backquotes with backslashes. - If the substitution appears within double quotes, bbaasshh does not perform + If the substitution appears within double quotes, bbaasshh does not perform word splitting and pathname expansion on the results. AArriitthhmmeettiicc EExxppaannssiioonn @@ -2205,197 +2205,197 @@ EEXXPPAANNSSIIOONN $$((((_e_x_p_r_e_s_s_i_o_n)))) - The _e_x_p_r_e_s_s_i_o_n undergoes the same expansions as if it were within double + The _e_x_p_r_e_s_s_i_o_n undergoes the same expansions as if it were within double quotes, but unescaped double quote characters in _e_x_p_r_e_s_s_i_o_n are not treated - specially and are removed. All tokens in the expression undergo parameter - and variable expansion, command substitution, and quote removal. The re- - sult is treated as the arithmetic expression to be evaluated. Since the - way Bash handles double quotes can potentially result in empty strings, - arithmetic expansion treats those as expressions that evaluate to 0. + specially and are removed. All tokens in the expression undergo parameter + and variable expansion, command substitution, and quote removal. The re- + sult is treated as the arithmetic expression to be evaluated. Since the + way Bash handles double quotes can potentially result in empty strings, + arithmetic expansion treats those as expressions that evaluate to 0. Arithmetic expansions may be nested. - The evaluation is performed according to the rules listed below under - AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If _e_x_p_r_e_s_s_i_o_n is invalid, bbaasshh prints a message to - standard error indicating failure, does not perform the substitution, and + The evaluation is performed according to the rules listed below under + AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN. If _e_x_p_r_e_s_s_i_o_n is invalid, bbaasshh prints a message to + standard error indicating failure, does not perform the substitution, and does not continue to execute the command in which the error occurs. PPrroocceessss SSuubbssttiittuuttiioonn - _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n allows a process's input or output to be referred to - using a filename. It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)). The process - _l_i_s_t, as long as it is not a null command without redirections, is run - asynchronously, and its input or output appears as a filename. This file- - name is passed as an argument to the current command as the result of the + _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n allows a process's input or output to be referred to + using a filename. It takes the form of <<((_l_i_s_t)) or >>((_l_i_s_t)). The process + _l_i_s_t, as long as it is not a null command without redirections, is run + asynchronously, and its input or output appears as a filename. This file- + name is passed as an argument to the current command as the result of the expansion. - If the >>((_l_i_s_t)) form is used, writing to the file provides input for _l_i_s_t. - If the <<((_l_i_s_t)) form is used, reading the file obtains the output of _l_i_s_t. - No space may appear between the << or >> and the left parenthesis, otherwise + If the >>((_l_i_s_t)) form is used, writing to the file provides input for _l_i_s_t. + If the <<((_l_i_s_t)) form is used, reading the file obtains the output of _l_i_s_t. + No space may appear between the << or >> and the left parenthesis, otherwise the construct would be interpreted as a redirection. - Process substitution is supported on systems that support named pipes (_F_I_- + Process substitution is supported on systems that support named pipes (_F_I_- _F_O_s) or the _/_d_e_v_/_f_d method of naming open files. When available, process substitution is performed simultaneously with para- - meter and variable expansion, command substitution, and arithmetic expan- + meter and variable expansion, command substitution, and arithmetic expan- sion. WWoorrdd SSpplliittttiinngg - The shell scans the results of parameter expansion, command substitution, - and arithmetic expansion that did not occur within double quotes for _w_o_r_d + The shell scans the results of parameter expansion, command substitution, + and arithmetic expansion that did not occur within double quotes for _w_o_r_d _s_p_l_i_t_t_i_n_g. Words that were not expanded are not split. - The shell treats each character of IIFFSS as a delimiter, and splits the re- - sults of the other expansions into words using these characters as field + The shell treats each character of IIFFSS as a delimiter, and splits the re- + sults of the other expansions into words using these characters as field terminators. - An _I_F_S _w_h_i_t_e_s_p_a_c_e character is whitespace as defined above (see DDeeffiinnii-- - ttiioonnss) that appears in the value of IIFFSS. Space, tab, and newline are al- - ways considered IFS whitespace, even if they don't appear in the locale's + An _I_F_S _w_h_i_t_e_s_p_a_c_e character is whitespace as defined above (see DDeeffiinnii-- + ttiioonnss) that appears in the value of IIFFSS. Space, tab, and newline are al- + ways considered IFS whitespace, even if they don't appear in the locale's ssppaaccee category. - If IIFFSS is unset, field splitting acts as if its value were - <><><>, and treats these characters as IFS whitespace. If + If IIFFSS is unset, field splitting acts as if its value were + <><><>, and treats these characters as IFS whitespace. If the value of IIFFSS is null, no word splitting occurs, but implicit null argu- ments (see below) are still removed. - Word splitting begins by removing sequences of IFS whitespace characters - from the beginning and end of the results of the previous expansions, then + Word splitting begins by removing sequences of IFS whitespace characters + from the beginning and end of the results of the previous expansions, then splits the remaining words. - If the value of IIFFSS consists solely of IFS whitespace, any sequence of IFS - whitespace characters delimits a field, so a field consists of characters - that are not unquoted IFS whitespace, and null fields result only from + If the value of IIFFSS consists solely of IFS whitespace, any sequence of IFS + whitespace characters delimits a field, so a field consists of characters + that are not unquoted IFS whitespace, and null fields result only from quoting. If IIFFSS contains a non-whitespace character, then any character in the value - of IIFFSS that is not IFS whitespace, along with any adjacent IFS whitespace - characters, delimits a field. This means that adjacent non-IFS-whitespace - delimiters produce a null field. A sequence of IFS whitespace characters + of IIFFSS that is not IFS whitespace, along with any adjacent IFS whitespace + characters, delimits a field. This means that adjacent non-IFS-whitespace + delimiters produce a null field. A sequence of IFS whitespace characters also delimits a field. - Explicit null arguments ("""" or '''') are retained and passed to commands as + Explicit null arguments ("""" or '''') are retained and passed to commands as empty strings. Unquoted implicit null arguments, resulting from the expan- sion of parameters that have no values, are removed. Expanding a parameter with no value within double quotes produces a null field, which is retained and passed to a command as an empty string. - When a quoted null argument appears as part of a word whose expansion is - non-null, word splitting removes the null argument portion, leaving the - non-null expansion. That is, the word "-d''" becomes "-d" after word + When a quoted null argument appears as part of a word whose expansion is + non-null, word splitting removes the null argument portion, leaving the + non-null expansion. That is, the word "-d''" becomes "-d" after word splitting and null argument removal. PPaatthhnnaammee EExxppaannssiioonn - After word splitting, unless the --ff option has been set, bbaasshh scans each - word for the characters **, ??, and [[. If one of these characters appears, - and is not quoted, then the word is regarded as a _p_a_t_t_e_r_n, and replaced - with a sorted list of filenames matching the pattern (see PPaatttteerrnn MMaattcchhiinngg + After word splitting, unless the --ff option has been set, bbaasshh scans each + word for the characters **, ??, and [[. If one of these characters appears, + and is not quoted, then the word is regarded as a _p_a_t_t_e_r_n, and replaced + with a sorted list of filenames matching the pattern (see PPaatttteerrnn MMaattcchhiinngg below) subject to the value of the GGLLOOBBSSOORRTT shell variable. - If no matching filenames are found, and the shell option nnuullllgglloobb is not + If no matching filenames are found, and the shell option nnuullllgglloobb is not enabled, the word is left unchanged. If the nnuullllgglloobb option is set, and no - matches are found, the word is removed. If the ffaaiillgglloobb shell option is - set, and no matches are found, bbaasshh prints an error message and does not - execute the command. If the shell option nnooccaasseegglloobb is enabled, the match + matches are found, the word is removed. If the ffaaiillgglloobb shell option is + set, and no matches are found, bbaasshh prints an error message and does not + execute the command. If the shell option nnooccaasseegglloobb is enabled, the match is performed without regard to the case of alphabetic characters. - When a pattern is used for pathname expansion, the character "." at the - start of a name or immediately following a slash must be matched explic- - itly, unless the shell option ddoottgglloobb is set. In order to match the file- - names _. and _._., the pattern must begin with "." (for example, ".?"), even - if ddoottgglloobb is set. If the gglloobbsskkiippddoottss shell option is enabled, the file- - names _. and _._. never match, even if the pattern begins with a ".". When + When a pattern is used for pathname expansion, the character "." at the + start of a name or immediately following a slash must be matched explic- + itly, unless the shell option ddoottgglloobb is set. In order to match the file- + names _. and _._., the pattern must begin with "." (for example, ".?"), even + if ddoottgglloobb is set. If the gglloobbsskkiippddoottss shell option is enabled, the file- + names _. and _._. never match, even if the pattern begins with a ".". When not matching pathnames, the "." character is not treated specially. - When matching a pathname, the slash character must always be matched ex- - plicitly by a slash in the pattern, but in other matching contexts it can - be matched by a special pattern character as described below under PPaatttteerrnn + When matching a pathname, the slash character must always be matched ex- + plicitly by a slash in the pattern, but in other matching contexts it can + be matched by a special pattern character as described below under PPaatttteerrnn MMaattcchhiinngg. - See the description of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for a de- - scription of the nnooccaasseegglloobb, nnuullllgglloobb, gglloobbsskkiippddoottss, ffaaiillgglloobb, and ddoottgglloobb + See the description of sshhoopptt below under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS for a de- + scription of the nnooccaasseegglloobb, nnuullllgglloobb, gglloobbsskkiippddoottss, ffaaiillgglloobb, and ddoottgglloobb shell options. The GGLLOOBBIIGGNNOORREE shell variable may be used to restrict the set of file names - matching a _p_a_t_t_e_r_n. If GGLLOOBBIIGGNNOORREE is set, each matching file name that - also matches one of the patterns in GGLLOOBBIIGGNNOORREE is removed from the list of - matches. If the nnooccaasseegglloobb option is set, the matching against the pat- - terns in GGLLOOBBIIGGNNOORREE is performed without regard to case. The filenames _. - and _._. are always ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, - setting GGLLOOBBIIGGNNOORREE to a non-null value has the effect of enabling the ddoott-- - gglloobb shell option, so all other filenames beginning with a "." match. To - get the old behavior of ignoring filenames beginning with a ".", make ".*" - one of the patterns in GGLLOOBBIIGGNNOORREE. The ddoottgglloobb option is disabled when + matching a _p_a_t_t_e_r_n. If GGLLOOBBIIGGNNOORREE is set, each matching file name that + also matches one of the patterns in GGLLOOBBIIGGNNOORREE is removed from the list of + matches. If the nnooccaasseegglloobb option is set, the matching against the pat- + terns in GGLLOOBBIIGGNNOORREE is performed without regard to case. The filenames _. + and _._. are always ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, + setting GGLLOOBBIIGGNNOORREE to a non-null value has the effect of enabling the ddoott-- + gglloobb shell option, so all other filenames beginning with a "." match. To + get the old behavior of ignoring filenames beginning with a ".", make ".*" + one of the patterns in GGLLOOBBIIGGNNOORREE. The ddoottgglloobb option is disabled when GGLLOOBBIIGGNNOORREE is unset. The GGLLOOBBIIGGNNOORREE pattern matching honors the setting of the eexxttgglloobb shell option. - The value of the GGLLOOBBSSOORRTT shell variable controls how the results of path- + The value of the GGLLOOBBSSOORRTT shell variable controls how the results of path- name expansion are sorted, as described above under SShheellll VVaarriiaabblleess. PPaatttteerrnn MMaattcchhiinngg - Any character that appears in a pattern, other than the special pattern - characters described below, matches itself. The NUL character may not oc- - cur in a pattern. A backslash escapes the following character; the escap- - ing backslash is discarded when matching. The special pattern characters + Any character that appears in a pattern, other than the special pattern + characters described below, matches itself. The NUL character may not oc- + cur in a pattern. A backslash escapes the following character; the escap- + ing backslash is discarded when matching. The special pattern characters must be quoted if they are to be matched literally. The special pattern characters have the following meanings: - ** Matches any string, including the null string. When the + ** Matches any string, including the null string. When the gglloobbssttaarr shell option is enabled, and ** is used in a pathname - expansion context, two adjacent **s used as a single pattern - match all files and zero or more directories and subdirecto- - ries. If followed by a //, two adjacent **s match only direc- + expansion context, two adjacent **s used as a single pattern + match all files and zero or more directories and subdirecto- + ries. If followed by a //, two adjacent **s match only direc- tories and subdirectories. ?? Matches any single character. [[...]] Matches any one of the characters enclosed between the brack- - ets. This is known as a _b_r_a_c_k_e_t _e_x_p_r_e_s_s_i_o_n and matches a + ets. This is known as a _b_r_a_c_k_e_t _e_x_p_r_e_s_s_i_o_n and matches a single character. A pair of characters separated by a hyphen - denotes a _r_a_n_g_e _e_x_p_r_e_s_s_i_o_n; any character that falls between - those two characters, inclusive, using the current locale's - collating sequence and character set, matches. If the first - character following the [[ is a !! or a ^^ then any character - not within the range matches. To match a --, include it as - the first or last character in the set. To match a ]], in- + denotes a _r_a_n_g_e _e_x_p_r_e_s_s_i_o_n; any character that falls between + those two characters, inclusive, using the current locale's + collating sequence and character set, matches. If the first + character following the [[ is a !! or a ^^ then any character + not within the range matches. To match a --, include it as + the first or last character in the set. To match a ]], in- clude it as the first character in the set. The sorting order of characters in range expressions, and the - characters included in the range, are determined by the col- - lating sequence of the current locale and the values of the + characters included in the range, are determined by the col- + lating sequence of the current locale and the values of the LLCC__CCOOLLLLAATTEE or LLCC__AALLLL shell variables, if set. - For example, in the C locale, [[aa--dd]] is equivalent to [[aabbccdd]]. - Many locales sort characters in dictionary order, and in + For example, in the C locale, [[aa--dd]] is equivalent to [[aabbccdd]]. + Many locales sort characters in dictionary order, and in these locales [[aa--dd]] is typically not equivalent to [[aabbccdd]]; it might be equivalent to [[aaBBbbCCccDDdd]] or [[aaAAbbBBccCCdd]]. To obtain the - traditional interpretation of range expressions, where [[aa--dd]] - is equivalent to [[aabbccdd]], set the value of the LLCC__CCOOLLLLAATTEE or - LLCC__AALLLL shell variables to CC, or enable the gglloobbaasscciiiirraannggeess + traditional interpretation of range expressions, where [[aa--dd]] + is equivalent to [[aabbccdd]], set the value of the LLCC__CCOOLLLLAATTEE or + LLCC__AALLLL shell variables to CC, or enable the gglloobbaasscciiiirraannggeess shell option. - Within a bracket expression, _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be speci- - fied using the syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is one of the + Within a bracket expression, _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be speci- + fied using the syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is one of the following classes defined in the POSIX standard: - aallnnuumm aallpphhaa aasscciiii bbllaannkk ccnnttrrll ddiiggiitt ggrraapphh lloowweerr pprriinntt ppuunncctt + aallnnuumm aallpphhaa aasscciiii bbllaannkk ccnnttrrll ddiiggiitt ggrraapphh lloowweerr pprriinntt ppuunncctt ssppaaccee uuppppeerr wwoorrdd xxddiiggiitt - A character class matches any character belonging to that + A character class matches any character belonging to that class. The wwoorrdd character class matches letters, digits, and the character _. - Within a bracket expression, an _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s can be - specified using the syntax [[==_c==]], which matches all charac- - ters with the same collation weight (as defined by the cur- + Within a bracket expression, an _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s can be + specified using the syntax [[==_c==]], which matches all charac- + ters with the same collation weight (as defined by the cur- rent locale) as the character _c. - Within a bracket expression, the syntax [[.._s_y_m_b_o_l..]] matches + Within a bracket expression, the syntax [[.._s_y_m_b_o_l..]] matches the collating symbol _s_y_m_b_o_l. - If the eexxttgglloobb shell option is enabled using the sshhoopptt builtin, the shell - recognizes several extended pattern matching operators. In the following - description, a _p_a_t_t_e_r_n_-_l_i_s_t is a list of one or more patterns separated by - a ||. Composite patterns may be formed using one or more of the following + If the eexxttgglloobb shell option is enabled using the sshhoopptt builtin, the shell + recognizes several extended pattern matching operators. In the following + description, a _p_a_t_t_e_r_n_-_l_i_s_t is a list of one or more patterns separated by + a ||. Composite patterns may be formed using one or more of the following sub-patterns: ??((_p_a_t_t_e_r_n_-_l_i_s_t)) @@ -2409,60 +2409,60 @@ EEXXPPAANNSSIIOONN !!((_p_a_t_t_e_r_n_-_l_i_s_t)) Matches anything except one of the given patterns. - The eexxttgglloobb option changes the behavior of the parser, since the parenthe- - ses are normally treated as operators with syntactic meaning. To ensure - that extended matching patterns are parsed correctly, make sure that eexxtt-- - gglloobb is enabled before parsing constructs containing the patterns, includ- + The eexxttgglloobb option changes the behavior of the parser, since the parenthe- + ses are normally treated as operators with syntactic meaning. To ensure + that extended matching patterns are parsed correctly, make sure that eexxtt-- + gglloobb is enabled before parsing constructs containing the patterns, includ- ing shell functions and command substitutions. - When matching filenames, the ddoottgglloobb shell option determines the set of - filenames that are tested: when ddoottgglloobb is enabled, the set of filenames - includes all files beginning with ".", but _. and _._. must be matched by a + When matching filenames, the ddoottgglloobb shell option determines the set of + filenames that are tested: when ddoottgglloobb is enabled, the set of filenames + includes all files beginning with ".", but _. and _._. must be matched by a pattern or sub-pattern that begins with a dot; when it is disabled, the set - does not include any filenames beginning with "." unless the pattern or - sub-pattern begins with a ".". If the gglloobbsskkiippddoottss shell option is en- - abled, the filenames _. and _._. never appear in the set. As above, "." only + does not include any filenames beginning with "." unless the pattern or + sub-pattern begins with a ".". If the gglloobbsskkiippddoottss shell option is en- + abled, the filenames _. and _._. never appear in the set. As above, "." only has a special meaning when matching filenames. - Complicated extended pattern matching against long strings is slow, espe- - cially when the patterns contain alternations and the strings contain mul- - tiple matches. Using separate matches against shorter strings, or using + Complicated extended pattern matching against long strings is slow, espe- + cially when the patterns contain alternations and the strings contain mul- + tiple matches. Using separate matches against shorter strings, or using arrays of strings instead of a single long string, may be faster. QQuuoottee RReemmoovvaall - After the preceding expansions, all unquoted occurrences of the characters - \\, '', and "" that did not result from one of the above expansions are re- + After the preceding expansions, all unquoted occurrences of the characters + \\, '', and "" that did not result from one of the above expansions are re- moved. RREEDDIIRREECCTTIIOONN - Before a command is executed, its input and output may be _r_e_d_i_r_e_c_t_e_d using - a special notation interpreted by the shell. _R_e_d_i_r_e_c_t_i_o_n allows commands' - file handles to be duplicated, opened, closed, made to refer to different + Before a command is executed, its input and output may be _r_e_d_i_r_e_c_t_e_d using + a special notation interpreted by the shell. _R_e_d_i_r_e_c_t_i_o_n allows commands' + file handles to be duplicated, opened, closed, made to refer to different files, and can change the files the command reads from and writes to. When used with the eexxeecc builtin, redirections modify file handles in the current - shell execution environment. The following redirection operators may pre- - cede or appear anywhere within a _s_i_m_p_l_e _c_o_m_m_a_n_d or may follow a _c_o_m_m_a_n_d. + shell execution environment. The following redirection operators may pre- + cede or appear anywhere within a _s_i_m_p_l_e _c_o_m_m_a_n_d or may follow a _c_o_m_m_a_n_d. Redirections are processed in the order they appear, from left to right. - Each redirection that may be preceded by a file descriptor number may in- - stead be preceded by a word of the form {_v_a_r_n_a_m_e}. In this case, for each - redirection operator except >>&&-- and <<&&--, the shell allocates a file de- - scriptor greater than or equal to 10 and assigns it to _v_a_r_n_a_m_e. If {_v_a_r_- + Each redirection that may be preceded by a file descriptor number may in- + stead be preceded by a word of the form {_v_a_r_n_a_m_e}. In this case, for each + redirection operator except >>&&-- and <<&&--, the shell allocates a file de- + scriptor greater than or equal to 10 and assigns it to _v_a_r_n_a_m_e. If {_v_a_r_- _n_a_m_e} precedes >>&&-- or <<&&--, the value of _v_a_r_n_a_m_e defines the file descriptor - to close. If {_v_a_r_n_a_m_e} is supplied, the redirection persists beyond the - scope of the command, which allows the shell programmer to manage the file + to close. If {_v_a_r_n_a_m_e} is supplied, the redirection persists beyond the + scope of the command, which allows the shell programmer to manage the file descriptor's lifetime manually without using the eexxeecc builtin. The vvaarrrreeddiirr__cclloossee shell option manages this behavior. - In the following descriptions, if the file descriptor number is omitted, + In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is "<", the redirection - refers to the standard input (file descriptor 0). If the first character - of the redirection operator is ">", the redirection refers to the standard + refers to the standard input (file descriptor 0). If the first character + of the redirection operator is ">", the redirection refers to the standard output (file descriptor 1). - The _w_o_r_d following the redirection operator in the following descriptions, - unless otherwise noted, is subjected to brace expansion, tilde expansion, - parameter and variable expansion, command substitution, arithmetic expan- + The _w_o_r_d following the redirection operator in the following descriptions, + unless otherwise noted, is subjected to brace expansion, tilde expansion, + parameter and variable expansion, command substitution, arithmetic expan- sion, quote removal, pathname expansion, and word splitting. If it expands to more than one word, bbaasshh reports an error. @@ -2470,18 +2470,18 @@ RREEDDIIRREECCTTIIOONN ls >> dirlist 2>>&&1 - directs both standard output and standard error to the file _d_i_r_l_i_s_t, while + directs both standard output and standard error to the file _d_i_r_l_i_s_t, while the command ls 2>>&&1 >> dirlist - directs only the standard output to file _d_i_r_l_i_s_t, because the standard er- - ror was directed to the standard output before the standard output was + directs only the standard output to file _d_i_r_l_i_s_t, because the standard er- + ror was directed to the standard output before the standard output was redirected to _d_i_r_l_i_s_t. - BBaasshh handles several filenames specially when they are used in redirec- - tions, as described in the following table. If the operating system on - which bbaasshh is running provides these special files, bbaasshh uses them; other- + BBaasshh handles several filenames specially when they are used in redirec- + tions, as described in the following table. If the operating system on + which bbaasshh is running provides these special files, bbaasshh uses them; other- wise it emulates them internally with the behavior described below. //ddeevv//ffdd//_f_d @@ -2493,21 +2493,21 @@ RREEDDIIRREECCTTIIOONN //ddeevv//ssttddeerrrr File descriptor 2 is duplicated. //ddeevv//ttccpp//_h_o_s_t//_p_o_r_t - If _h_o_s_t is a valid hostname or Internet address, and _p_o_r_t is + If _h_o_s_t is a valid hostname or Internet address, and _p_o_r_t is an integer port number or service name, bbaasshh attempts to open the corresponding TCP socket. //ddeevv//uuddpp//_h_o_s_t//_p_o_r_t - If _h_o_s_t is a valid hostname or Internet address, and _p_o_r_t is + If _h_o_s_t is a valid hostname or Internet address, and _p_o_r_t is an integer port number or service name, bbaasshh attempts to open the corresponding UDP socket. A failure to open or create a file causes the redirection to fail. - Redirections using file descriptors greater than 9 should be used with + Redirections using file descriptors greater than 9 should be used with care, as they may conflict with file descriptors the shell uses internally. RReeddiirreeccttiinngg IInnppuutt - Redirecting input opens the file whose name results from the expansion of + Redirecting input opens the file whose name results from the expansion of _w_o_r_d for reading on file descriptor _n, or the standard input (file descrip- tor 0) if _n is not specified. @@ -2516,25 +2516,25 @@ RREEDDIIRREECCTTIIOONN [_n]<<_w_o_r_d RReeddiirreeccttiinngg OOuuttppuutt - Redirecting output opens the file whose name results from the expansion of - _w_o_r_d for writing on file descriptor _n, or the standard output (file de- - scriptor 1) if _n is not specified. If the file does not exist it is cre- + Redirecting output opens the file whose name results from the expansion of + _w_o_r_d for writing on file descriptor _n, or the standard output (file de- + scriptor 1) if _n is not specified. If the file does not exist it is cre- ated; if it does exist it is truncated to zero size. The general format for redirecting output is: [_n]>>_w_o_r_d - If the redirection operator is >>, and the nnoocclloobbbbeerr option to the sseett - builtin command has been enabled, the redirection fails if the file whose - name results from the expansion of _w_o_r_d exists and is a regular file. If - the redirection operator is >>||, or the redirection operator is >> and the + If the redirection operator is >>, and the nnoocclloobbbbeerr option to the sseett + builtin command has been enabled, the redirection fails if the file whose + name results from the expansion of _w_o_r_d exists and is a regular file. If + the redirection operator is >>||, or the redirection operator is >> and the nnoocclloobbbbeerr option to the sseett builtin is not enabled, bbaasshh attempts the redi- rection even if the file named by _w_o_r_d exists. AAppppeennddiinngg RReeddiirreecctteedd OOuuttppuutt - Redirecting output in this fashion opens the file whose name results from - the expansion of _w_o_r_d for appending on file descriptor _n, or the standard + Redirecting output in this fashion opens the file whose name results from + the expansion of _w_o_r_d for appending on file descriptor _n, or the standard output (file descriptor 1) if _n is not specified. If the file does not ex- ist it is created. @@ -2543,7 +2543,7 @@ RREEDDIIRREECCTTIIOONN [_n]>>>>_w_o_r_d RReeddiirreeccttiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr - This construct redirects both the standard output (file descriptor 1) and + This construct redirects both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to the file whose name is the expansion of _w_o_r_d. @@ -2553,13 +2553,13 @@ RREEDDIIRREECCTTIIOONN and >>&&_w_o_r_d - Of the two forms, the first is preferred. This is semantically equivalent + Of the two forms, the first is preferred. This is semantically equivalent to >>_w_o_r_d 2>>&&1 - When using the second form, _w_o_r_d may not expand to a number or --. If it - does, other redirection operators apply (see DDuupplliiccaattiinngg FFiillee DDeessccrriippttoorrss + When using the second form, _w_o_r_d may not expand to a number or --. If it + does, other redirection operators apply (see DDuupplliiccaattiinngg FFiillee DDeessccrriippttoorrss below) for compatibility reasons. AAppppeennddiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr @@ -2579,8 +2579,8 @@ RREEDDIIRREECCTTIIOONN HHeerree DDooccuummeennttss This type of redirection instructs the shell to read input from the current - source until it reads a line containing only _d_e_l_i_m_i_t_e_r (with no trailing - blanks). All of the lines read up to that point then become the standard + source until it reads a line containing only _d_e_l_i_m_i_t_e_r (with no trailing + blanks). All of the lines read up to that point then become the standard input (or file descriptor _n if _n is specified) for a command. The format of here-documents is: @@ -2589,25 +2589,25 @@ RREEDDIIRREECCTTIIOONN _h_e_r_e_-_d_o_c_u_m_e_n_t _d_e_l_i_m_i_t_e_r - The shell does not perform parameter and variable expansion, command sub- + The shell does not perform parameter and variable expansion, command sub- stitution, arithmetic expansion, or pathname expansion on _w_o_r_d. If any part of _w_o_r_d is quoted, the _d_e_l_i_m_i_t_e_r is the result of quote removal - on _w_o_r_d, and the lines in the here-document are not expanded. If _w_o_r_d is - unquoted, the _d_e_l_i_m_i_t_e_r is _w_o_r_d itself, and the here-document text is + on _w_o_r_d, and the lines in the here-document are not expanded. If _w_o_r_d is + unquoted, the _d_e_l_i_m_i_t_e_r is _w_o_r_d itself, and the here-document text is treated similarly to a double-quoted string: all lines of the here-document - are subjected to parameter expansion, command substitution, and arithmetic + are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \\<> is treated as a line continua- tion, and \\ must be used to quote the characters \\, $$, and ``; however, dou- ble quote characters have no special meaning. - If the redirection operator is <<<<--, then the shell strips all leading tab + If the redirection operator is <<<<--, then the shell strips all leading tab characters from input lines and the line containing _d_e_l_i_m_i_t_e_r. This allows here-documents within shell scripts to be indented in a natural fashion. If the delimiter is not quoted, the shell treats the \\<> sequence as - a line continuation: the two lines are joined and the backslash-newline is - removed. This happens while reading the here-document, before the check + a line continuation: the two lines are joined and the backslash-newline is + removed. This happens while reading the here-document, before the check for the ending delimiter, so joined lines can form the end delimiter. HHeerree SSttrriinnggss @@ -2615,10 +2615,10 @@ RREEDDIIRREECCTTIIOONN [_n]<<<<<<_w_o_r_d - The _w_o_r_d undergoes tilde expansion, parameter and variable expansion, com- - mand substitution, arithmetic expansion, and quote removal. Pathname ex- - pansion and word splitting are not performed. The result is supplied as a - single string, with a newline appended, to the command on its standard in- + The _w_o_r_d undergoes tilde expansion, parameter and variable expansion, com- + mand substitution, arithmetic expansion, and quote removal. Pathname ex- + pansion and word splitting are not performed. The result is supplied as a + single string, with a newline appended, to the command on its standard in- put (or file descriptor _n if _n is specified). DDuupplliiccaattiinngg FFiillee DDeessccrriippttoorrss @@ -2626,10 +2626,10 @@ RREEDDIIRREECCTTIIOONN [_n]<<&&_w_o_r_d - is used to duplicate input file descriptors. If _w_o_r_d expands to one or - more digits, file descriptor _n is made to be a copy of that file descrip- + is used to duplicate input file descriptors. If _w_o_r_d expands to one or + more digits, file descriptor _n is made to be a copy of that file descrip- tor. It is a redirection error if the digits in _w_o_r_d do not specify a file - descriptor open for input. If _w_o_r_d evaluates to --, file descriptor _n is + descriptor open for input. If _w_o_r_d evaluates to --, file descriptor _n is closed. If _n is not specified, this uses the standard input (file descrip- tor 0). @@ -2638,11 +2638,11 @@ RREEDDIIRREECCTTIIOONN [_n]>>&&_w_o_r_d is used similarly to duplicate output file descriptors. If _n is not speci- - fied, this uses the standard output (file descriptor 1). It is a redirec- - tion error if the digits in _w_o_r_d do not specify a file descriptor open for + fied, this uses the standard output (file descriptor 1). It is a redirec- + tion error if the digits in _w_o_r_d do not specify a file descriptor open for output. If _w_o_r_d evaluates to --, file descriptor _n is closed. As a special case, if _n is omitted, and _w_o_r_d does not expand to one or more digits or --, - this redirects the standard output and standard error as described previ- + this redirects the standard output and standard error as described previ- ously. MMoovviinngg FFiillee DDeessccrriippttoorrss @@ -2658,7 +2658,7 @@ RREEDDIIRREECCTTIIOONN [_n]>>&&_d_i_g_i_t-- - moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard out- + moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard out- put (file descriptor 1) if _n is not specified. OOppeenniinngg FFiillee DDeessccrriippttoorrss ffoorr RReeaaddiinngg aanndd WWrriittiinngg @@ -2666,166 +2666,166 @@ RREEDDIIRREECCTTIIOONN [_n]<<>>_w_o_r_d - opens the file whose name is the expansion of _w_o_r_d for both reading and - writing on file descriptor _n, or on file descriptor 0 if _n is not speci- + opens the file whose name is the expansion of _w_o_r_d for both reading and + writing on file descriptor _n, or on file descriptor 0 if _n is not speci- fied. If the file does not exist, it is created. AALLIIAASSEESS - _A_l_i_a_s_e_s allow a string to be substituted for a word that is in a position - in the input where it can be the first word of a simple command. Aliases - have names and corresponding values that are set and unset using the aalliiaass + _A_l_i_a_s_e_s allow a string to be substituted for a word that is in a position + in the input where it can be the first word of a simple command. Aliases + have names and corresponding values that are set and unset using the aalliiaass and uunnaalliiaass builtin commands (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - If the shell reads an unquoted word in the right position, it checks the + If the shell reads an unquoted word in the right position, it checks the word to see if it matches an alias name. If it matches, the shell replaces - the word with the alias value, and reads that value as if it had been read - instead of the word. The shell doesn't look at any characters following + the word with the alias value, and reads that value as if it had been read + instead of the word. The shell doesn't look at any characters following the word before attempting alias substitution. - The characters //, $$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s or quot- - ing characters listed above may not appear in an alias name. The replace- - ment text may contain any valid shell input, including shell metacharac- - ters. The first word of the replacement text is tested for aliases, but a - word that is identical to an alias being expanded is not expanded a second - time. This means that one may alias llss to llss --FF, for instance, and bbaasshh + The characters //, $$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s or quot- + ing characters listed above may not appear in an alias name. The replace- + ment text may contain any valid shell input, including shell metacharac- + ters. The first word of the replacement text is tested for aliases, but a + word that is identical to an alias being expanded is not expanded a second + time. This means that one may alias llss to llss --FF, for instance, and bbaasshh does not try to recursively expand the replacement text. - If the last character of the alias value is a _b_l_a_n_k, the shell checks the + If the last character of the alias value is a _b_l_a_n_k, the shell checks the next command word following the alias for alias expansion. Aliases are created and listed with the aalliiaass command, and removed with the uunnaalliiaass command. - There is no mechanism for using arguments in the replacement text. If ar- + There is no mechanism for using arguments in the replacement text. If ar- guments are needed, use a shell function (see FFUUNNCCTTIIOONNSS below) instead. - Aliases are not expanded when the shell is not interactive, unless the eexx-- - ppaanndd__aalliiaasseess shell option is set using sshhoopptt (see the description of sshhoopptt + Aliases are not expanded when the shell is not interactive, unless the eexx-- + ppaanndd__aalliiaasseess shell option is set using sshhoopptt (see the description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The rules concerning the definition and use of aliases are somewhat confus- - ing. BBaasshh always reads at least one complete line of input, and all lines - that make up a compound command, before executing any of the commands on - that line or the compound command. Aliases are expanded when a command is + ing. BBaasshh always reads at least one complete line of input, and all lines + that make up a compound command, before executing any of the commands on + that line or the compound command. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take effect until the shell reads - the next line of input, and an alias definition in a compound command does - not take effect until the shell parses and executes the entire compound - command. The commands following the alias definition on that line, or in - the rest of a compound command, are not affected by the new alias. This - behavior is also an issue when functions are executed. Aliases are ex- - panded when a function definition is read, not when the function is exe- - cuted, because a function definition is itself a command. As a conse- - quence, aliases defined in a function are not available until after that - function is executed. To be safe, always put alias definitions on a sepa- + the next line of input, and an alias definition in a compound command does + not take effect until the shell parses and executes the entire compound + command. The commands following the alias definition on that line, or in + the rest of a compound command, are not affected by the new alias. This + behavior is also an issue when functions are executed. Aliases are ex- + panded when a function definition is read, not when the function is exe- + cuted, because a function definition is itself a command. As a conse- + quence, aliases defined in a function are not available until after that + function is executed. To be safe, always put alias definitions on a sepa- rate line, and do not use aalliiaass in compound commands. For almost every purpose, shell functions are preferable to aliases. FFUUNNCCTTIIOONNSS - A shell function, defined as described above under SSHHEELLLL GGRRAAMMMMAARR, stores a - series of commands for later execution. When the name of a shell function - is used as a simple command name, the shell executes the list of commands - associated with that function name. Functions are executed in the context - of the calling shell; there is no new process created to interpret them + A shell function, defined as described above under SSHHEELLLL GGRRAAMMMMAARR, stores a + series of commands for later execution. When the name of a shell function + is used as a simple command name, the shell executes the list of commands + associated with that function name. Functions are executed in the context + of the calling shell; there is no new process created to interpret them (contrast this with the execution of a shell script). When a function is executed, the arguments to the function become the posi- tional parameters during its execution. The special parameter ## is updated - to reflect the new positional parameters. Special parameter 00 is un- - changed. The first element of the FFUUNNCCNNAAMMEE variable is set to the name of + to reflect the new positional parameters. Special parameter 00 is un- + changed. The first element of the FFUUNNCCNNAAMMEE variable is set to the name of the function while the function is executing. - All other aspects of the shell execution environment are identical between + All other aspects of the shell execution environment are identical between a function and its caller with these exceptions: the DDEEBBUUGG and RREETTUURRNN traps - (see the description of the ttrraapp builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS be- - low) are not inherited unless the function has been given the ttrraaccee at- - tribute (see the description of the ddeeccllaarree builtin below) or the --oo ffuunncc-- + (see the description of the ttrraapp builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS be- + low) are not inherited unless the function has been given the ttrraaccee at- + tribute (see the description of the ddeeccllaarree builtin below) or the --oo ffuunncc-- ttrraaccee shell option has been enabled with the sseett builtin (in which case all - functions inherit the DDEEBBUUGG and RREETTUURRNN traps), and the EERRRR trap is not in- + functions inherit the DDEEBBUUGG and RREETTUURRNN traps), and the EERRRR trap is not in- herited unless the --oo eerrrrttrraaccee shell option has been enabled. Variables local to the function are declared with the llooccaall builtin command - (_l_o_c_a_l _v_a_r_i_a_b_l_e_s). Ordinarily, variables and their values are shared be- - tween the function and its caller. If a variable is declared llooccaall, the - variable's visible scope is restricted to that function and its children + (_l_o_c_a_l _v_a_r_i_a_b_l_e_s). Ordinarily, variables and their values are shared be- + tween the function and its caller. If a variable is declared llooccaall, the + variable's visible scope is restricted to that function and its children (including the functions it calls). - In the following description, the _c_u_r_r_e_n_t _s_c_o_p_e is a currently- executing - function. Previous scopes consist of that function's caller and so on, - back to the "global" scope, where the shell is not executing any shell + In the following description, the _c_u_r_r_e_n_t _s_c_o_p_e is a currently- executing + function. Previous scopes consist of that function's caller and so on, + back to the "global" scope, where the shell is not executing any shell function. A local variable at the current scope is a variable declared us- ing the llooccaall or ddeeccllaarree builtins in the function that is currently execut- ing. - Local variables "shadow" variables with the same name declared at previous - scopes. For instance, a local variable declared in a function hides vari- - ables with the same name declared at previous scopes, including global - variables: references and assignments refer to the local variable, leaving - the variables at previous scopes unmodified. When the function returns, + Local variables "shadow" variables with the same name declared at previous + scopes. For instance, a local variable declared in a function hides vari- + ables with the same name declared at previous scopes, including global + variables: references and assignments refer to the local variable, leaving + the variables at previous scopes unmodified. When the function returns, the global variable is once again visible. - The shell uses _d_y_n_a_m_i_c _s_c_o_p_i_n_g to control a variable's visibility within - functions. With dynamic scoping, visible variables and their values are a + The shell uses _d_y_n_a_m_i_c _s_c_o_p_i_n_g to control a variable's visibility within + functions. With dynamic scoping, visible variables and their values are a result of the sequence of function calls that caused execution to reach the - current function. The value of a variable that a function sees depends on - its value within its caller, if any, whether that caller is the global + current function. The value of a variable that a function sees depends on + its value within its caller, if any, whether that caller is the global scope or another shell function. This is also the value that a local vari- - able declaration shadows, and the value that is restored when the function + able declaration shadows, and the value that is restored when the function returns. - For example, if a variable _v_a_r is declared as local in function _f_u_n_c_1, and - _f_u_n_c_1 calls another function _f_u_n_c_2, references to _v_a_r made from within - _f_u_n_c_2 resolve to the local variable _v_a_r from _f_u_n_c_1, shadowing any global + For example, if a variable _v_a_r is declared as local in function _f_u_n_c_1, and + _f_u_n_c_1 calls another function _f_u_n_c_2, references to _v_a_r made from within + _f_u_n_c_2 resolve to the local variable _v_a_r from _f_u_n_c_1, shadowing any global variable named _v_a_r. - The uunnsseett builtin also acts using the same dynamic scope: if a variable is + The uunnsseett builtin also acts using the same dynamic scope: if a variable is local to the current scope, uunnsseett unsets it; otherwise the unset will refer - to the variable found in any calling scope as described above. If a vari- - able at the current local scope is unset, it remains so (appearing as un- - set) until it is reset in that scope or until the function returns. Once - the function returns, any instance of the variable at a previous scope be- - comes visible. If the unset acts on a variable at a previous scope, any - instance of a variable with that name that had been shadowed becomes visi- + to the variable found in any calling scope as described above. If a vari- + able at the current local scope is unset, it remains so (appearing as un- + set) until it is reset in that scope or until the function returns. Once + the function returns, any instance of the variable at a previous scope be- + comes visible. If the unset acts on a variable at a previous scope, any + instance of a variable with that name that had been shadowed becomes visi- ble (see below how the llooccaallvvaarr__uunnsseett shell option changes this behavior). - The FFUUNNCCNNEESSTT variable, if set to a numeric value greater than 0, defines a + The FFUUNNCCNNEESSTT variable, if set to a numeric value greater than 0, defines a maximum function nesting level. Function invocations that exceed the limit cause the entire command to abort. - If the builtin command rreettuurrnn is executed in a function, the function com- + If the builtin command rreettuurrnn is executed in a function, the function com- pletes and execution resumes with the next command after the function call. - If rreettuurrnn is supplied a numeric argument, that is the function's return - status; otherwise the function's return status is the exit status of the - last command executed before the rreettuurrnn. Any command associated with the - RREETTUURRNN trap is executed before execution resumes. When a function com- + If rreettuurrnn is supplied a numeric argument, that is the function's return + status; otherwise the function's return status is the exit status of the + last command executed before the rreettuurrnn. Any command associated with the + RREETTUURRNN trap is executed before execution resumes. When a function com- pletes, the values of the positional parameters and the special parameter ## are restored to the values they had prior to the function's execution. - The --ff option to the ddeeccllaarree or ttyyppeesseett builtin commands lists function + The --ff option to the ddeeccllaarree or ttyyppeesseett builtin commands lists function names and definitions. The --FF option to ddeeccllaarree or ttyyppeesseett lists the func- - tion names only (and optionally the source file and line number, if the + tion names only (and optionally the source file and line number, if the eexxttddeebbuugg shell option is enabled). Functions may be exported so that child - shell processes (those created when executing a separate shell invocation) - automatically have them defined with the --ff option to the eexxppoorrtt builtin. + shell processes (those created when executing a separate shell invocation) + automatically have them defined with the --ff option to the eexxppoorrtt builtin. The --ff option to the uunnsseett builtin deletes a function definition. Functions may be recursive. The FFUUNNCCNNEESSTT variable may be used to limit the - depth of the function call stack and restrict the number of function invo- - cations. By default, bbaasshh imposes no limit on the number of recursive + depth of the function call stack and restrict the number of function invo- + cations. By default, bbaasshh imposes no limit on the number of recursive calls. AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN The shell allows arithmetic expressions to be evaluated, under certain cir- - cumstances (see the lleett and ddeeccllaarree builtin commands, the (((( compound com- - mand, the arithmetic ffoorr command, the [[[[ conditional command, and AArriitthh-- + cumstances (see the lleett and ddeeccllaarree builtin commands, the (((( compound com- + mand, the arithmetic ffoorr command, the [[[[ conditional command, and AArriitthh-- mmeettiicc EExxppaannssiioonn). - Evaluation is done in the largest fixed-width integers available, with no - check for overflow, though division by 0 is trapped and flagged as an er- + Evaluation is done in the largest fixed-width integers available, with no + check for overflow, though division by 0 is trapped and flagged as an er- ror. The operators and their precedence, associativity, and values are the same as in the C language. The following list of operators is grouped into - levels of equal-precedence operators. The levels are listed in order of + levels of equal-precedence operators. The levels are listed in order of decreasing precedence. _i_d++++ _i_d---- @@ -2853,59 +2853,59 @@ AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN _e_x_p_r_1 ,, _e_x_p_r_2 comma - Shell variables are allowed as operands; parameter expansion is performed - before the expression is evaluated. Within an expression, shell variables - may also be referenced by name without using the parameter expansion syn- - tax. This means you can use "x", where _x is a shell variable name, in an - arithmetic expression, and the shell will evaluate its value as an expres- - sion and use the result. A shell variable that is null or unset evaluates + Shell variables are allowed as operands; parameter expansion is performed + before the expression is evaluated. Within an expression, shell variables + may also be referenced by name without using the parameter expansion syn- + tax. This means you can use "x", where _x is a shell variable name, in an + arithmetic expression, and the shell will evaluate its value as an expres- + sion and use the result. A shell variable that is null or unset evaluates to 0 when referenced by name in an expression. The value of a variable is evaluated as an arithmetic expression when it is - referenced, or when a variable which has been given the _i_n_t_e_g_e_r attribute - using ddeeccllaarree --ii is assigned a value. A null value evaluates to 0. A + referenced, or when a variable which has been given the _i_n_t_e_g_e_r attribute + using ddeeccllaarree --ii is assigned a value. A null value evaluates to 0. A shell variable need not have its _i_n_t_e_g_e_r attribute enabled to be used in an expression. - Integer constants follow the C language definition, without suffixes or - character constants. Constants with a leading 0 are interpreted as octal - numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, numbers take - the form [_b_a_s_e_#]n, where the optional _b_a_s_e is a decimal number between 2 - and 64 representing the arithmetic base, and _n is a number in that base. - If _b_a_s_e_# is omitted, then base 10 is used. When specifying _n, if a non- - digit is required, the digits greater than 9 are represented by the lower- - case letters, the uppercase letters, @, and _, in that order. If _b_a_s_e is - less than or equal to 36, lowercase and uppercase letters may be used in- + Integer constants follow the C language definition, without suffixes or + character constants. Constants with a leading 0 are interpreted as octal + numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, numbers take + the form [_b_a_s_e_#]n, where the optional _b_a_s_e is a decimal number between 2 + and 64 representing the arithmetic base, and _n is a number in that base. + If _b_a_s_e_# is omitted, then base 10 is used. When specifying _n, if a non- + digit is required, the digits greater than 9 are represented by the lower- + case letters, the uppercase letters, @, and _, in that order. If _b_a_s_e is + less than or equal to 36, lowercase and uppercase letters may be used in- terchangeably to represent numbers between 10 and 35. - Operators are evaluated in precedence order. Sub-expressions in parenthe- + Operators are evaluated in precedence order. Sub-expressions in parenthe- ses are evaluated first and may override the precedence rules above. CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS - Conditional expressions are used by the [[[[ compound command and the tteesstt - and [[ builtin commands to test file attributes and perform string and - arithmetic comparisons. The tteesstt and [[ commands determine their behavior - based on the number of arguments; see the descriptions of those commands + Conditional expressions are used by the [[[[ compound command and the tteesstt + and [[ builtin commands to test file attributes and perform string and + arithmetic comparisons. The tteesstt and [[ commands determine their behavior + based on the number of arguments; see the descriptions of those commands for any other command-specific actions. - Expressions are formed from the unary or binary primaries listed below. - Unary expressions are often used to examine the status of a file or shell - variable. Binary operators are used for string, numeric, and file at- + Expressions are formed from the unary or binary primaries listed below. + Unary expressions are often used to examine the status of a file or shell + variable. Binary operators are used for string, numeric, and file at- tribute comparisons. BBaasshh handles several filenames specially when they are used in expressions. - If the operating system on which bbaasshh is running provides these special - files, bash will use them; otherwise it will emulate them internally with - this behavior: If any _f_i_l_e argument to one of the primaries is of the form + If the operating system on which bbaasshh is running provides these special + files, bash will use them; otherwise it will emulate them internally with + this behavior: If any _f_i_l_e argument to one of the primaries is of the form _/_d_e_v_/_f_d_/_n, then bbaasshh checks file descriptor _n. If the _f_i_l_e argument to one - of the primaries is one of _/_d_e_v_/_s_t_d_i_n, _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, bbaasshh + of the primaries is one of _/_d_e_v_/_s_t_d_i_n, _/_d_e_v_/_s_t_d_o_u_t, or _/_d_e_v_/_s_t_d_e_r_r, bbaasshh checks file descriptor 0, 1, or 2, respectively. Unless otherwise specified, primaries that operate on files follow symbolic links and operate on the target of the link, rather than the link itself. - When used with [[[[, or when the shell is in posix mode, the << and >> opera- - tors sort lexicographically using the current locale. When the shell is + When used with [[[[, or when the shell is in posix mode, the << and >> opera- + tors sort lexicographically using the current locale. When the shell is not in posix mode, the tteesstt command sorts using ASCII ordering. --aa _f_i_l_e @@ -2944,20 +2944,20 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS --LL _f_i_l_e True if _f_i_l_e exists and is a symbolic link. --NN _f_i_l_e - True if _f_i_l_e exists and has been modified since it was last ac- + True if _f_i_l_e exists and has been modified since it was last ac- cessed. --OO _f_i_l_e True if _f_i_l_e exists and is owned by the effective user id. --SS _f_i_l_e True if _f_i_l_e exists and is a socket. --oo _o_p_t_n_a_m_e - True if the shell option _o_p_t_n_a_m_e is enabled. See the list of op- - tions under the description of the --oo option to the sseett builtin be- + True if the shell option _o_p_t_n_a_m_e is enabled. See the list of op- + tions under the description of the --oo option to the sseett builtin be- low. --vv _v_a_r_n_a_m_e - True if the shell variable _v_a_r_n_a_m_e is set (has been assigned a + True if the shell variable _v_a_r_n_a_m_e is set (has been assigned a value). If _v_a_r_n_a_m_e is an indexed array variable name subscripted by - _@ or _*, this returns true if the array has any set elements. If + _@ or _*, this returns true if the array has any set elements. If _v_a_r_n_a_m_e is an associative array variable name subscripted by _@ or _*, this returns true if an element with that key is set. --RR _v_a_r_n_a_m_e @@ -2970,8 +2970,8 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS _s_t_r_i_n_g_1 ==== _s_t_r_i_n_g_2 _s_t_r_i_n_g_1 == _s_t_r_i_n_g_2 - True if the strings are equal. == should be used with the tteesstt com- - mand for POSIX conformance. When used with the [[[[ command, this + True if the strings are equal. == should be used with the tteesstt com- + mand for POSIX conformance. When used with the [[[[ command, this performs pattern matching as described above (CCoommppoouunndd CCoommmmaannddss). _s_t_r_i_n_g_1 !!== _s_t_r_i_n_g_2 True if the strings are not equal. @@ -2983,296 +2983,296 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS _f_i_l_e_1 --eeff _f_i_l_e_2 True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode numbers. _f_i_l_e_1 -nntt _f_i_l_e_2 - True if _f_i_l_e_1 is newer (according to modification date) than _f_i_l_e_2, + True if _f_i_l_e_1 is newer (according to modification date) than _f_i_l_e_2, or if _f_i_l_e_1 exists and _f_i_l_e_2 does not. _f_i_l_e_1 -oott _f_i_l_e_2 True if _f_i_l_e_1 is older than _f_i_l_e_2, or if _f_i_l_e_2 exists and _f_i_l_e_1 does not. _a_r_g_1 OOPP _a_r_g_2 - OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic bi- - nary operators return true if _a_r_g_1 is equal to, not equal to, less - than, less than or equal to, greater than, or greater than or equal - to _a_r_g_2, respectively. _a_r_g_1 and _a_r_g_2 may be positive or negative - integers. When used with the [[[[ command, _a_r_g_1 and _a_r_g_2 are evalu- - ated as arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above). - Since the expansions the [[[[ command performs on _a_r_g_1 and _a_r_g_2 can - potentially result in empty strings, arithmetic expression evalua- + OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic bi- + nary operators return true if _a_r_g_1 is equal to, not equal to, less + than, less than or equal to, greater than, or greater than or equal + to _a_r_g_2, respectively. _a_r_g_1 and _a_r_g_2 may be positive or negative + integers. When used with the [[[[ command, _a_r_g_1 and _a_r_g_2 are evalu- + ated as arithmetic expressions (see AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN above). + Since the expansions the [[[[ command performs on _a_r_g_1 and _a_r_g_2 can + potentially result in empty strings, arithmetic expression evalua- tion treats those as expressions that evaluate to 0. SSIIMMPPLLEE CCOOMMMMAANNDD EEXXPPAANNSSIIOONN - When the shell executes a simple command, it performs the following expan- - sions, assignments, and redirections, from left to right, in the following + When the shell executes a simple command, it performs the following expan- + sions, assignments, and redirections, from left to right, in the following order. - 1. The words that the parser has marked as variable assignments (those - preceding the command name) and redirections are saved for later + 1. The words that the parser has marked as variable assignments (those + preceding the command name) and redirections are saved for later processing. - 2. The words that are not variable assignments or redirections are ex- - panded. If any words remain after expansion, the first word is - taken to be the name of the command and the remaining words are the + 2. The words that are not variable assignments or redirections are ex- + panded. If any words remain after expansion, the first word is + taken to be the name of the command and the remaining words are the arguments. 3. Redirections are performed as described above under RREEDDIIRREECCTTIIOONN. 4. The text after the == in each variable assignment undergoes tilde ex- - pansion, parameter expansion, command substitution, arithmetic ex- + pansion, parameter expansion, command substitution, arithmetic ex- pansion, and quote removal before being assigned to the variable. - If no command name results, the variable assignments affect the current - shell environment. In the case of such a command (one that consists only - of assignment statements and redirections), assignment statements are per- - formed before redirections. Otherwise, the variables are added to the en- + If no command name results, the variable assignments affect the current + shell environment. In the case of such a command (one that consists only + of assignment statements and redirections), assignment statements are per- + formed before redirections. Otherwise, the variables are added to the en- vironment of the executed command and do not affect the current shell envi- - ronment. If any of the assignments attempts to assign a value to a read- - only variable, an error occurs, and the command exits with a non-zero sta- + ronment. If any of the assignments attempts to assign a value to a read- + only variable, an error occurs, and the command exits with a non-zero sta- tus. - If no command name results, redirections are performed, but do not affect - the current shell environment. A redirection error causes the command to + If no command name results, redirections are performed, but do not affect + the current shell environment. A redirection error causes the command to exit with a non-zero status. - If there is a command name left after expansion, execution proceeds as de- - scribed below. Otherwise, the command exits. If one of the expansions - contained a command substitution, the exit status of the command is the - exit status of the last command substitution performed. If there were no + If there is a command name left after expansion, execution proceeds as de- + scribed below. Otherwise, the command exits. If one of the expansions + contained a command substitution, the exit status of the command is the + exit status of the last command substitution performed. If there were no command substitutions, the command exits with a zero status. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN - After a command has been split into words, if it results in a simple com- - mand and an optional list of arguments, the shell performs the following + After a command has been split into words, if it results in a simple com- + mand and an optional list of arguments, the shell performs the following actions. - If the command name contains no slashes, the shell attempts to locate it. - If there exists a shell function by that name, that function is invoked as - described above in FFUUNNCCTTIIOONNSS. If the name does not match a function, the - shell searches for it in the list of shell builtins. If a match is found, + If the command name contains no slashes, the shell attempts to locate it. + If there exists a shell function by that name, that function is invoked as + described above in FFUUNNCCTTIIOONNSS. If the name does not match a function, the + shell searches for it in the list of shell builtins. If a match is found, that builtin is invoked. - If the name is neither a shell function nor a builtin, and contains no - slashes, bbaasshh searches each element of the PPAATTHH for a directory containing - an executable file by that name. BBaasshh uses a hash table to remember the - full pathnames of executable files (see hhaasshh under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS + If the name is neither a shell function nor a builtin, and contains no + slashes, bbaasshh searches each element of the PPAATTHH for a directory containing + an executable file by that name. BBaasshh uses a hash table to remember the + full pathnames of executable files (see hhaasshh under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). Bash performs a full search of the directories in PPAATTHH only if the command is not found in the hash table. If the search is unsuccessful, the shell searches for a defined shell function named ccoommmmaanndd__nnoott__ffoouunndd__hhaannddllee. - If that function exists, it is invoked in a separate execution environment + If that function exists, it is invoked in a separate execution environment with the original command and the original command's arguments as its argu- - ments, and the function's exit status becomes the exit status of that sub- - shell. If that function is not defined, the shell prints an error message + ments, and the function's exit status becomes the exit status of that sub- + shell. If that function is not defined, the shell prints an error message and returns an exit status of 127. - If the search is successful, or if the command name contains one or more + If the search is successful, or if the command name contains one or more slashes, the shell executes the named program in a separate execution envi- - ronment. Argument 0 is set to the name given, and the remaining arguments + ronment. Argument 0 is set to the name given, and the remaining arguments to the command are set to the arguments given, if any. - If this execution fails because the file is not in executable format, and - the file is not a directory, it is assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a file - containing shell commands, and the shell creates a new instance of itself - to execute it. Bash tries to determine whether the file is a text file or - a binary, and will not execute files it determines to be binaries. This - subshell reinitializes itself, so that the effect is as if a new shell had + If this execution fails because the file is not in executable format, and + the file is not a directory, it is assumed to be a _s_h_e_l_l _s_c_r_i_p_t, a file + containing shell commands, and the shell creates a new instance of itself + to execute it. Bash tries to determine whether the file is a text file or + a binary, and will not execute files it determines to be binaries. This + subshell reinitializes itself, so that the effect is as if a new shell had been invoked to handle the script, with the exception that the locations of - commands remembered by the parent (see hhaasshh below under SSHHEELLLL BBUUIILLTTIINN CCOOMM-- + commands remembered by the parent (see hhaasshh below under SSHHEELLLL BBUUIILLTTIINN CCOOMM-- MMAANNDDSS are retained by the child. If the program is a file beginning with ##!!, the remainder of the first line specifies an interpreter for the program. The shell executes the specified - interpreter on operating systems that do not handle this executable format - themselves. The arguments to the interpreter consist of a single optional - argument following the interpreter name on the first line of the program, - followed by the name of the program, followed by the command arguments, if + interpreter on operating systems that do not handle this executable format + themselves. The arguments to the interpreter consist of a single optional + argument following the interpreter name on the first line of the program, + followed by the name of the program, followed by the command arguments, if any. CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENNTT The shell has an _e_x_e_c_u_t_i_o_n _e_n_v_i_r_o_n_m_e_n_t, which consists of the following: - * Open files inherited by the shell at invocation, as modified by + * Open files inherited by the shell at invocation, as modified by redirections supplied to the eexxeecc builtin. - * The current working directory as set by ccdd, ppuusshhdd, or ppooppdd, or in- + * The current working directory as set by ccdd, ppuusshhdd, or ppooppdd, or in- herited by the shell at invocation. - * The file creation mode mask as set by uummaasskk or inherited from the + * The file creation mode mask as set by uummaasskk or inherited from the shell's parent. * Current traps set by ttrraapp. - * Shell parameters that are set by variable assignment or with sseett or + * Shell parameters that are set by variable assignment or with sseett or inherited from the shell's parent in the environment. - * Shell functions defined during execution or inherited from the + * Shell functions defined during execution or inherited from the shell's parent in the environment. - * Options enabled at invocation (either by default or with command- + * Options enabled at invocation (either by default or with command- line arguments) or by sseett. * Options enabled by sshhoopptt. * Shell aliases defined with aalliiaass. - * Various process IDs, including those of background jobs, the value + * Various process IDs, including those of background jobs, the value of $$$$, and the value of PPPPIIDD. - When a simple command other than a builtin or shell function is to be exe- - cuted, it is invoked in a separate execution environment that consists of - the following. Unless otherwise noted, the values are inherited from the + When a simple command other than a builtin or shell function is to be exe- + cuted, it is invoked in a separate execution environment that consists of + the following. Unless otherwise noted, the values are inherited from the shell. - * The shell's open files, plus any modifications and additions speci- + * The shell's open files, plus any modifications and additions speci- fied by redirections to the command. * The current working directory. * The file creation mode mask. - * Shell variables and functions marked for export, along with vari- + * Shell variables and functions marked for export, along with vari- ables exported for the command, passed in the environment. * Traps caught by the shell are reset to the values inherited from the shell's parent, and traps ignored by the shell are ignored. - A command invoked in this separate environment cannot affect the shell's + A command invoked in this separate environment cannot affect the shell's execution environment. A _s_u_b_s_h_e_l_l is a copy of the shell process. - Command substitution, commands grouped with parentheses, and asynchronous - commands are invoked in a subshell environment that is a duplicate of the - shell environment, except that traps caught by the shell are reset to the - values that the shell inherited from its parent at invocation. Builtin - commands that are invoked as part of a pipeline, except possibly in the - last element depending on the value of the llaassttppiippee shell option, are also - executed in a subshell environment. Changes made to the subshell environ- + Command substitution, commands grouped with parentheses, and asynchronous + commands are invoked in a subshell environment that is a duplicate of the + shell environment, except that traps caught by the shell are reset to the + values that the shell inherited from its parent at invocation. Builtin + commands that are invoked as part of a pipeline, except possibly in the + last element depending on the value of the llaassttppiippee shell option, are also + executed in a subshell environment. Changes made to the subshell environ- ment cannot affect the shell's execution environment. - When the shell is in posix mode, subshells spawned to execute command sub- - stitutions inherit the value of the --ee option from their parent shell. - When not in posix mode, bbaasshh clears the --ee option in such subshells. See - the description of the iinnhheerriitt__eerrrreexxiitt shell option below for how to con- + When the shell is in posix mode, subshells spawned to execute command sub- + stitutions inherit the value of the --ee option from their parent shell. + When not in posix mode, bbaasshh clears the --ee option in such subshells. See + the description of the iinnhheerriitt__eerrrreexxiitt shell option below for how to con- trol this behavior when not in posix mode. - If a command is followed by a && and job control is not active, the default + If a command is followed by a && and job control is not active, the default standard input for the command is the empty file _/_d_e_v_/_n_u_l_l, unless the com- - mand has an explicit redirection involving the standard input. Otherwise, - the invoked command inherits the file descriptors of the calling shell as + mand has an explicit redirection involving the standard input. Otherwise, + the invoked command inherits the file descriptors of the calling shell as modified by redirections. EENNVVIIRROONNMMEENNTT - When a program is invoked it is given an array of strings called the _e_n_v_i_- + When a program is invoked it is given an array of strings called the _e_n_v_i_- _r_o_n_m_e_n_t. This is a list of _n_a_m_e-_v_a_l_u_e pairs, of the form _n_a_m_e=_v_a_l_u_e. - The shell provides several ways to manipulate the environment. On invoca- - tion, the shell scans its own environment and creates a parameter for each - name found, automatically marking it for _e_x_p_o_r_t to child processes. Exe- - cuted commands inherit the environment. The eexxppoorrtt, ddeeccllaarree --xx, and uunnsseett + The shell provides several ways to manipulate the environment. On invoca- + tion, the shell scans its own environment and creates a parameter for each + name found, automatically marking it for _e_x_p_o_r_t to child processes. Exe- + cuted commands inherit the environment. The eexxppoorrtt, ddeeccllaarree --xx, and uunnsseett commands modify the environment by adding and deleting parameters and func- tions. If the value of a parameter in the environment is modified, the new - value automatically becomes part of the environment, replacing the old. - The environment inherited by any executed command consists of the shell's - initial environment, whose values may be modified in the shell, less any - pairs removed by the uunnsseett or eexxppoorrtt --nn commands, plus any additions via + value automatically becomes part of the environment, replacing the old. + The environment inherited by any executed command consists of the shell's + initial environment, whose values may be modified in the shell, less any + pairs removed by the uunnsseett or eexxppoorrtt --nn commands, plus any additions via the eexxppoorrtt and ddeeccllaarree --xx commands. - If any parameter assignments, as described above in PPAARRAAMMEETTEERRSS, appear be- - fore a _s_i_m_p_l_e _c_o_m_m_a_n_d, the variable assignments are part of that command's + If any parameter assignments, as described above in PPAARRAAMMEETTEERRSS, appear be- + fore a _s_i_m_p_l_e _c_o_m_m_a_n_d, the variable assignments are part of that command's environment for as long as it executes. These assignment statements affect - only the environment seen by that command. If these assignments precede a - call to a shell function, the variables are local to the function and ex- + only the environment seen by that command. If these assignments precede a + call to a shell function, the variables are local to the function and ex- ported to that function's children. If the --kk option is set (see the sseett builtin command below), then _a_l_l para- - meter assignments are placed in the environment for a command, not just + meter assignments are placed in the environment for a command, not just those that precede the command name. - When bbaasshh invokes an external command, the variable __ is set to the full + When bbaasshh invokes an external command, the variable __ is set to the full pathname of the command and passed to that command in its environment. EEXXIITT SSTTAATTUUSS The exit status of an executed command is the value returned by the _w_a_i_t_p_i_d - system call or equivalent function. Exit statuses fall between 0 and 255, - though, as explained below, the shell may use values above 125 specially. + system call or equivalent function. Exit statuses fall between 0 and 255, + though, as explained below, the shell may use values above 125 specially. Exit statuses from shell builtins and compound commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes. For the shell's purposes, a command which exits with a zero exit status has - succeeded. So while an exit status of zero indicates success, a non-zero + succeeded. So while an exit status of zero indicates success, a non-zero exit status indicates failure. When a command terminates on a fatal signal _N, bbaasshh uses the value of 128+_N as the exit status. - If a command is not found, the child process created to execute it returns - a status of 127. If a command is found but is not executable, the return + If a command is not found, the child process created to execute it returns + a status of 127. If a command is found but is not executable, the return status is 126. If a command fails because of an error during expansion or redirection, the exit status is greater than zero. - Shell builtin commands return a status of 0 (_t_r_u_e) if successful, and non- + Shell builtin commands return a status of 0 (_t_r_u_e) if successful, and non- zero (_f_a_l_s_e) if an error occurs while they execute. All builtins return an - exit status of 2 to indicate incorrect usage, generally invalid options or + exit status of 2 to indicate incorrect usage, generally invalid options or missing arguments. - The exit status of the last command is available in the special parameter + The exit status of the last command is available in the special parameter $?. - BBaasshh itself returns the exit status of the last command executed, unless a - syntax error occurs, in which case it exits with a non-zero value. See + BBaasshh itself returns the exit status of the last command executed, unless a + syntax error occurs, in which case it exits with a non-zero value. See also the eexxiitt builtin command below. SSIIGGNNAALLSS - When bbaasshh is interactive, in the absence of any traps, it ignores SSIIGGTTEERRMM - (so that kkiillll 00 does not kill an interactive shell), and catches and han- - dles SSIIGGIINNTT (so that the wwaaiitt builtin is interruptible). When bbaasshh re- - ceives SSIIGGIINNTT, it breaks out of any executing loops and command lists. In + When bbaasshh is interactive, in the absence of any traps, it ignores SSIIGGTTEERRMM + (so that kkiillll 00 does not kill an interactive shell), and catches and han- + dles SSIIGGIINNTT (so that the wwaaiitt builtin is interruptible). When bbaasshh re- + ceives SSIIGGIINNTT, it breaks out of any executing loops and command lists. In all cases, bbaasshh ignores SSIIGGQQUUIITT. If job control is in effect, bbaasshh ignores SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP. The ttrraapp builtin modifies the shell's signal handling, as described below. - Non-builtin commands bbaasshh executes have signal handlers set to the values - inherited by the shell from its parent, unless ttrraapp sets them to be ig- - nored, in which case the child process will ignore them as well. When job - control is not in effect, asynchronous commands ignore SSIIGGIINNTT and SSIIGGQQUUIITT - in addition to these inherited handlers. Commands run as a result of com- - mand substitution ignore the keyboard-generated job control signals SSIIGGTT-- + Non-builtin commands bbaasshh executes have signal handlers set to the values + inherited by the shell from its parent, unless ttrraapp sets them to be ig- + nored, in which case the child process will ignore them as well. When job + control is not in effect, asynchronous commands ignore SSIIGGIINNTT and SSIIGGQQUUIITT + in addition to these inherited handlers. Commands run as a result of com- + mand substitution ignore the keyboard-generated job control signals SSIIGGTT-- TTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP. - The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting, an - interactive shell resends the SSIIGGHHUUPP to all jobs, running or stopped. The - shell sends SSIIGGCCOONNTT to stopped jobs to ensure that they receive the SSIIGGHHUUPP - (see JJOOBB CCOONNTTRROOLL below for more information about running and stopped - jobs). To prevent the shell from sending the signal to a particular job, - remove it from the jobs table with the ddiissoowwnn builtin (see SSHHEELLLL BBUUIILLTTIINN + The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting, an + interactive shell resends the SSIIGGHHUUPP to all jobs, running or stopped. The + shell sends SSIIGGCCOONNTT to stopped jobs to ensure that they receive the SSIIGGHHUUPP + (see JJOOBB CCOONNTTRROOLL below for more information about running and stopped + jobs). To prevent the shell from sending the signal to a particular job, + remove it from the jobs table with the ddiissoowwnn builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or mark it not to receive SSIIGGHHUUPP using ddiissoowwnn --hh. If the hhuuppoonneexxiitt shell option has been set using sshhoopptt, bbaasshh sends a SSIIGGHHUUPP to all jobs when an interactive login shell exits. - If bbaasshh is waiting for a command to complete and receives a signal for - which a trap has been set, it will not execute the trap until the command - completes. If bbaasshh is waiting for an asynchronous command via the wwaaiitt - builtin, and it receives a signal for which a trap has been set, the wwaaiitt + If bbaasshh is waiting for a command to complete and receives a signal for + which a trap has been set, it will not execute the trap until the command + completes. If bbaasshh is waiting for an asynchronous command via the wwaaiitt + builtin, and it receives a signal for which a trap has been set, the wwaaiitt builtin will return immediately with an exit status greater than 128, imme- diately after which the shell executes the trap. - When job control is not enabled, and bbaasshh is waiting for a foreground com- - mand to complete, the shell receives keyboard-generated signals such as + When job control is not enabled, and bbaasshh is waiting for a foreground com- + mand to complete, the shell receives keyboard-generated signals such as SSIIGGIINNTT (usually generated by ^^CC) that users commonly intend to send to that - command. This happens because the shell and the command are in the same + command. This happens because the shell and the command are in the same process group as the terminal, and ^^CC sends SSIIGGIINNTT to all processes in that - process group. Since bbaasshh does not enable job control by default when the - shell is not interactive, this scenario is most common in non-interactive + process group. Since bbaasshh does not enable job control by default when the + shell is not interactive, this scenario is most common in non-interactive shells. - When job control is enabled, and bbaasshh is waiting for a foreground command + When job control is enabled, and bbaasshh is waiting for a foreground command to complete, the shell does not receive keyboard-generated signals, because it is not in the same process group as the terminal. This scenario is most - common in interactive shells, where bbaasshh attempts to enable job control by + common in interactive shells, where bbaasshh attempts to enable job control by default. See JJOOBB CCOONNTTRROOLL below for more information about process groups. When job control is not enabled, and bbaasshh receives SSIIGGIINNTT while waiting for @@ -3280,75 +3280,75 @@ SSIIGGNNAALLSS then decides what to do about the SSIIGGIINNTT: 1. If the command terminates due to the SSIIGGIINNTT, bbaasshh concludes that the - user meant to send the SSIIGGIINNTT to the shell as well, and acts on the - SSIIGGIINNTT (e.g., by running a SSIIGGIINNTT trap, exiting a non-interactive + user meant to send the SSIIGGIINNTT to the shell as well, and acts on the + SSIIGGIINNTT (e.g., by running a SSIIGGIINNTT trap, exiting a non-interactive shell, or returning to the top level to read a new command). 2. If the command does not terminate due to SSIIGGIINNTT, the program handled - the SSIIGGIINNTT itself and did not treat it as a fatal signal. In that - case, bbaasshh does not treat SSIIGGIINNTT as a fatal signal, either, instead - assuming that the SSIIGGIINNTT was used as part of the program's normal - operation (e.g., emacs uses it to abort editing commands) or delib- - erately discarded. However, bbaasshh will run any trap set on SSIIGGIINNTT, - as it does with any other trapped signal it receives while it is + the SSIIGGIINNTT itself and did not treat it as a fatal signal. In that + case, bbaasshh does not treat SSIIGGIINNTT as a fatal signal, either, instead + assuming that the SSIIGGIINNTT was used as part of the program's normal + operation (e.g., emacs uses it to abort editing commands) or delib- + erately discarded. However, bbaasshh will run any trap set on SSIIGGIINNTT, + as it does with any other trapped signal it receives while it is waiting for the foreground command to complete, for compatibility. - When job control is enabled, bbaasshh does not receive keyboard-generated sig- - nals such as SSIIGGIINNTT while it is waiting for a foreground command. An in- - teractive shell does not pay attention to the SSIIGGIINNTT, even if the fore- - ground command terminates as a result, other than noting its exit status. - If the shell is not interactive, and the foreground command terminates due - to the SSIIGGIINNTT, bbaasshh pretends it received the SSIIGGIINNTT itself (scenario 1 + When job control is enabled, bbaasshh does not receive keyboard-generated sig- + nals such as SSIIGGIINNTT while it is waiting for a foreground command. An in- + teractive shell does not pay attention to the SSIIGGIINNTT, even if the fore- + ground command terminates as a result, other than noting its exit status. + If the shell is not interactive, and the foreground command terminates due + to the SSIIGGIINNTT, bbaasshh pretends it received the SSIIGGIINNTT itself (scenario 1 above), for compatibility. JJOOBB CCOONNTTRROOLL - _J_o_b _c_o_n_t_r_o_l refers to the ability to selectively stop (_s_u_s_p_e_n_d) the execu- - tion of processes and continue (_r_e_s_u_m_e) their execution at a later point. - A user typically employs this facility via an interactive interface sup- + _J_o_b _c_o_n_t_r_o_l refers to the ability to selectively stop (_s_u_s_p_e_n_d) the execu- + tion of processes and continue (_r_e_s_u_m_e) their execution at a later point. + A user typically employs this facility via an interactive interface sup- plied jointly by the operating system kernel's terminal driver and bbaasshh. - The shell associates a _j_o_b with each pipeline. It keeps a table of cur- + The shell associates a _j_o_b with each pipeline. It keeps a table of cur- rently executing jobs, which the jjoobbss command will display. Each job has a - _j_o_b _n_u_m_b_e_r, which jjoobbss displays between brackets. Job numbers start at 1. + _j_o_b _n_u_m_b_e_r, which jjoobbss displays between brackets. Job numbers start at 1. When bbaasshh starts a job asynchronously (in the _b_a_c_k_g_r_o_u_n_d), it prints a line that looks like: [1] 25647 - indicating that this job is job number 1 and that the process ID of the + indicating that this job is job number 1 and that the process ID of the last process in the pipeline associated with this job is 25647. All of the - processes in a single pipeline are members of the same job. BBaasshh uses the + processes in a single pipeline are members of the same job. BBaasshh uses the _j_o_b abstraction as the basis for job control. To facilitate the implementation of the user interface to job control, each - process has a _p_r_o_c_e_s_s _g_r_o_u_p _I_D, and the operating system maintains the no- - tion of a _c_u_r_r_e_n_t _t_e_r_m_i_n_a_l _p_r_o_c_e_s_s _g_r_o_u_p _I_D. This terminal process group + process has a _p_r_o_c_e_s_s _g_r_o_u_p _I_D, and the operating system maintains the no- + tion of a _c_u_r_r_e_n_t _t_e_r_m_i_n_a_l _p_r_o_c_e_s_s _g_r_o_u_p _I_D. This terminal process group ID is associated with the _c_o_n_t_r_o_l_l_i_n_g _t_e_r_m_i_n_a_l. - Processes that have the same process group ID are said to be part of the - same _p_r_o_c_e_s_s _g_r_o_u_p. Members of the _f_o_r_e_g_r_o_u_n_d process group (processes - whose process group ID is equal to the current terminal process group ID) - receive keyboard-generated signals such as SSIIGGIINNTT. Processes in the fore- - ground process group are said to be _f_o_r_e_g_r_o_u_n_d processes. _B_a_c_k_g_r_o_u_n_d - processes are those whose process group ID differs from the controlling - terminal's; such processes are immune to keyboard-generated signals. Only - foreground processes are allowed to read from or, if the user so specifies - with "stty tostop", write to the controlling terminal. The system sends a + Processes that have the same process group ID are said to be part of the + same _p_r_o_c_e_s_s _g_r_o_u_p. Members of the _f_o_r_e_g_r_o_u_n_d process group (processes + whose process group ID is equal to the current terminal process group ID) + receive keyboard-generated signals such as SSIIGGIINNTT. Processes in the fore- + ground process group are said to be _f_o_r_e_g_r_o_u_n_d processes. _B_a_c_k_g_r_o_u_n_d + processes are those whose process group ID differs from the controlling + terminal's; such processes are immune to keyboard-generated signals. Only + foreground processes are allowed to read from or, if the user so specifies + with "stty tostop", write to the controlling terminal. The system sends a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal to background processes which attempt to read from - (write to when "tostop" is in effect) the terminal, which, unless caught, + (write to when "tostop" is in effect) the terminal, which, unless caught, suspends the process. If the operating system on which bbaasshh is running supports job control, bbaasshh contains facilities to use it. Typing the _s_u_s_p_e_n_d character (typically ^^ZZ, - Control-Z) while a process is running stops that process and returns con- + Control-Z) while a process is running stops that process and returns con- trol to bbaasshh. Typing the _d_e_l_a_y_e_d _s_u_s_p_e_n_d character (typically ^^YY, Control- - Y) causes the process stop when it attempts to read input from the termi- - nal, and returns control to bbaasshh. The user then manipulates the state of - this job, using the bbgg command to continue it in the background, the ffgg - command to continue it in the foreground, or the kkiillll command to kill it. + Y) causes the process stop when it attempts to read input from the termi- + nal, and returns control to bbaasshh. The user then manipulates the state of + this job, using the bbgg command to continue it in the background, the ffgg + command to continue it in the foreground, or the kkiillll command to kill it. The suspend character takes effect immediately, and has the additional side - effect of discarding any pending output and typeahead. To force a back- - ground process to stop, or stop a process that's not associated with the + effect of discarding any pending output and typeahead. To force a back- + ground process to stop, or stop a process that's not associated with the current terminal session, send it the SSIIGGSSTTOOPP signal using kkiillll. There are a number of ways to refer to a job in the shell. The %% character @@ -3356,89 +3356,89 @@ JJOOBB CCOONNTTRROOLL Job number _n may be referred to as %%nn. A job may also be referred to using a prefix of the name used to start it, or using a substring that appears in - its command line. For example, %%ccee refers to a job whose command name be- - gins with ccee. Using %%??ccee, on the other hand, refers to any job containing + its command line. For example, %%ccee refers to a job whose command name be- + gins with ccee. Using %%??ccee, on the other hand, refers to any job containing the string ccee in its command line. If the prefix or substring matches more than one job, bbaasshh reports an error. - The symbols %%%% and %%++ refer to the shell's notion of the _c_u_r_r_e_n_t _j_o_b. A - single % (with no accompanying job specification) also refers to the cur- - rent job. %%-- refers to the _p_r_e_v_i_o_u_s _j_o_b. When a job starts in the back- - ground, a job stops while in the foreground, or a job is resumed in the - background, it becomes the current job. The job that was the current job - becomes the previous job. When the current job terminates, the previous - job becomes the current job. If there is only a single job, %%++ and %%-- can + The symbols %%%% and %%++ refer to the shell's notion of the _c_u_r_r_e_n_t _j_o_b. A + single % (with no accompanying job specification) also refers to the cur- + rent job. %%-- refers to the _p_r_e_v_i_o_u_s _j_o_b. When a job starts in the back- + ground, a job stops while in the foreground, or a job is resumed in the + background, it becomes the current job. The job that was the current job + becomes the previous job. When the current job terminates, the previous + job becomes the current job. If there is only a single job, %%++ and %%-- can both be used to refer to that job. In output pertaining to jobs (e.g., the output of the jjoobbss command), the current job is always marked with a ++, and the previous job with a --. - Simply naming a job can be used to bring it into the foreground: %%11 is a - synonym for "fg %1", bringing job 1 from the background into the fore- - ground. Similarly, "%1 &" resumes job 1 in the background, equivalent to + Simply naming a job can be used to bring it into the foreground: %%11 is a + synonym for "fg %1", bringing job 1 from the background into the fore- + ground. Similarly, "%1 &" resumes job 1 in the background, equivalent to "bg %1". - The shell learns immediately whenever a job changes state. Normally, bbaasshh - waits until it is about to print a prompt before notifying the user about - changes in a job's status so as to not interrupt any other output, though + The shell learns immediately whenever a job changes state. Normally, bbaasshh + waits until it is about to print a prompt before notifying the user about + changes in a job's status so as to not interrupt any other output, though it will notify of changes in a job's status after a foreground command in a - list completes, before executing the next command in the list. If the --bb - option to the sseett builtin command is enabled, bbaasshh reports status changes - immediately. BBaasshh executes any trap on SSIIGGCCHHLLDD for each child that termi- + list completes, before executing the next command in the list. If the --bb + option to the sseett builtin command is enabled, bbaasshh reports status changes + immediately. BBaasshh executes any trap on SSIIGGCCHHLLDD for each child that termi- nates. When a job terminates and bbaasshh notifies the user about it, bbaasshh removes the - job from the table. It will not appear in jjoobbss output, but wwaaiitt will re- - port its exit status, as long as it's supplied the process ID associated - with the job as an argument. When the table is empty, job numbers start + job from the table. It will not appear in jjoobbss output, but wwaaiitt will re- + port its exit status, as long as it's supplied the process ID associated + with the job as an argument. When the table is empty, job numbers start over at 1. - If a user attempts to exit bbaasshh while jobs are stopped (or, if the cchheecckk-- - jjoobbss shell option has been enabled using the sshhoopptt builtin, running), the - shell prints a warning message, and, if the cchheecckkjjoobbss option is enabled, - lists the jobs and their statuses. The jjoobbss command may then be used to - inspect their status. If the user immediately attempts to exit again, - without an intervening command, bbaasshh does not print another warning, and + If a user attempts to exit bbaasshh while jobs are stopped (or, if the cchheecckk-- + jjoobbss shell option has been enabled using the sshhoopptt builtin, running), the + shell prints a warning message, and, if the cchheecckkjjoobbss option is enabled, + lists the jobs and their statuses. The jjoobbss command may then be used to + inspect their status. If the user immediately attempts to exit again, + without an intervening command, bbaasshh does not print another warning, and terminates any stopped jobs. - When the shell is waiting for a job or process using the wwaaiitt builtin, and - job control is enabled, wwaaiitt will return when the job changes state. The - --ff option causes wwaaiitt to wait until the job or process terminates before + When the shell is waiting for a job or process using the wwaaiitt builtin, and + job control is enabled, wwaaiitt will return when the job changes state. The + --ff option causes wwaaiitt to wait until the job or process terminates before returning. PPRROOMMPPTTIINNGG - When executing interactively, bbaasshh displays the primary prompt PPSS11 when it + When executing interactively, bbaasshh displays the primary prompt PPSS11 when it is ready to read a command, and the secondary prompt PPSS22 when it needs more input to complete a command. - BBaasshh examines the value of the array variable PPRROOMMPPTT__CCOOMMMMAANNDD just before - printing each primary prompt. If any elements in PPRROOMMPPTT__CCOOMMMMAANNDD are set + BBaasshh examines the value of the array variable PPRROOMMPPTT__CCOOMMMMAANNDD just before + printing each primary prompt. If any elements in PPRROOMMPPTT__CCOOMMMMAANNDD are set and non-null, Bash executes each value, in numeric order, just as if it had been typed on the command line. BBaasshh displays PPSS00 after it reads a command but before executing it. - BBaasshh displays PPSS44 as described above before tracing each command when the + BBaasshh displays PPSS44 as described above before tracing each command when the --xx option is enabled. - BBaasshh allows the prompt strings PPSS00, PPSS11, PPSS22, and PPSS44, to be customized by + BBaasshh allows the prompt strings PPSS00, PPSS11, PPSS22, and PPSS44, to be customized by inserting a number of backslash-escaped special characters that are decoded as follows: \\aa An ASCII bell character (07). \\dd The date in "Weekday Month Date" format (e.g., "Tue May 26"). \\DD{{_f_o_r_m_a_t}} - The _f_o_r_m_a_t is passed to _s_t_r_f_t_i_m_e(3) and the result is in- - serted into the prompt string; an empty _f_o_r_m_a_t results in a - locale-specific time representation. The braces are re- + The _f_o_r_m_a_t is passed to _s_t_r_f_t_i_m_e(3) and the result is in- + serted into the prompt string; an empty _f_o_r_m_a_t results in a + locale-specific time representation. The braces are re- quired. \\ee An ASCII escape character (033). \\hh The hostname up to the first ".". \\HH The hostname. \\jj The number of jobs currently managed by the shell. - \\ll The basename of the shell's terminal device name (e.g., + \\ll The basename of the shell's terminal device name (e.g., "ttys0"). \\nn A newline. \\rr A carriage return. - \\ss The name of the shell: the basename of $$00 (the portion fol- + \\ss The name of the shell: the basename of $$00 (the portion fol- lowing the final slash). \\tt The current time in 24-hour HH:MM:SS format. \\TT The current time in 12-hour HH:MM:SS format. @@ -3448,7 +3448,7 @@ PPRROOMMPPTTIINNGG \\vv The bbaasshh version (e.g., 2.00). \\VV The bbaasshh release, version + patch level (e.g., 2.00.0) \\ww The value of the PPWWDD shell variable ($$PPWWDD), with $$HHOOMMEE abbre- - viated with a tilde (uses the value of the PPRROOMMPPTT__DDIIRRTTRRIIMM + viated with a tilde (uses the value of the PPRROOMMPPTT__DDIIRRTTRRIIMM variable). \\WW The basename of $$PPWWDD, with $$HHOOMMEE abbreviated with a tilde. \\!! The history number of this command. @@ -3456,95 +3456,95 @@ PPRROOMMPPTTIINNGG \\$$ If the effective UID is 0, a ##, otherwise a $$. \\_n_n_n The character corresponding to the octal number _n_n_n. \\\\ A backslash. - \\[[ Begin a sequence of non-printing characters, which could be - used to embed a terminal control sequence into the prompt. - This escape is only useful when the prompt will be supplied - to rreeaaddlliinnee, and is ignored and removed otherwise, so it - shouldn't be used in PPSS00 or PPSS44 or when line editing is not + \\[[ Begin a sequence of non-printing characters, which could be + used to embed a terminal control sequence into the prompt. + This escape is only useful when the prompt will be supplied + to rreeaaddlliinnee, and is ignored and removed otherwise, so it + shouldn't be used in PPSS00 or PPSS44 or when line editing is not enabled. \\]] End a sequence of non-printing characters begun with \\[[. - The command number and the history number are usually different: the his- + The command number and the history number are usually different: the his- tory number of a command is its position in the history list, which may in- - clude commands restored from the history file (see HHIISSTTOORRYY below), while - the command number is the position in the sequence of commands executed - during the current shell session. After the string is decoded, it is ex- + clude commands restored from the history file (see HHIISSTTOORRYY below), while + the command number is the position in the sequence of commands executed + during the current shell session. After the string is decoded, it is ex- panded via parameter expansion, command substitution, arithmetic expansion, and quote removal, subject to the value of the pprroommppttvvaarrss shell option (see - the description of the sshhoopptt command under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). - This can have unwanted side effects if escaped portions of the string ap- - pear within command substitution or contain characters special to word ex- + the description of the sshhoopptt command under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). + This can have unwanted side effects if escaped portions of the string ap- + pear within command substitution or contain characters special to word ex- pansion. RREEAADDLLIINNEE - This is the library that handles reading input when using an interactive + This is the library that handles reading input when using an interactive shell, unless the ----nnooeeddiittiinngg option is supplied at shell invocation. Line - editing is also used when using the --ee option to the rreeaadd builtin. By de- - fault, the line editing commands are similar to those of emacs; a vi-style - line editing interface is also available. Line editing can be enabled at - any time using the --oo eemmaaccss or --oo vvii options to the sseett builtin (see SSHHEELLLL - BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off line editing after the shell is run- + editing is also used when using the --ee option to the rreeaadd builtin. By de- + fault, the line editing commands are similar to those of emacs; a vi-style + line editing interface is also available. Line editing can be enabled at + any time using the --oo eemmaaccss or --oo vvii options to the sseett builtin (see SSHHEELLLL + BBUUIILLTTIINN CCOOMMMMAANNDDSS below). To turn off line editing after the shell is run- ning, use the ++oo eemmaaccss or ++oo vvii options to the sseett builtin. RReeaaddlliinnee NNoottaattiioonn - This section uses Emacs-style editing concepts and uses its notation for - keystrokes. Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. - Similarly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. The Meta + This section uses Emacs-style editing concepts and uses its notation for + keystrokes. Control keys are denoted by C-_k_e_y, e.g., C-n means Control-N. + Similarly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x means Meta-X. The Meta key is often labeled "Alt" or "Option". - On keyboards without a _M_e_t_a key, M-_x means ESC _x, i.e., press and release - the Escape key, then press and release the _x key, in sequence. This makes - ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x means ESC Control-_x: press and - release the Escape key, then press and hold the Control key while pressing + On keyboards without a _M_e_t_a key, M-_x means ESC _x, i.e., press and release + the Escape key, then press and release the _x key, in sequence. This makes + ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x means ESC Control-_x: press and + release the Escape key, then press and hold the Control key while pressing the _x key, then release both. - On some keyboards, the Meta key modifier produces characters with the + On some keyboards, the Meta key modifier produces characters with the eighth bit (0200) set. You can use the eennaabbllee--mmeettaa--kkeeyy variable to control - whether or not it does this, if the keyboard allows it. On many others, - the terminal or terminal emulator converts the metafied key to a key se- + whether or not it does this, if the keyboard allows it. On many others, + the terminal or terminal emulator converts the metafied key to a key se- quence beginning with ESC as described in the preceding paragraph. - If your _M_e_t_a key produces a key sequence with the ESC meta prefix, you can - make M-_k_e_y key bindings you specify (see RReeaaddlliinnee KKeeyy BBiinnddiinnggss below) do + If your _M_e_t_a key produces a key sequence with the ESC meta prefix, you can + make M-_k_e_y key bindings you specify (see RReeaaddlliinnee KKeeyy BBiinnddiinnggss below) do the same thing by setting the ffoorrccee--mmeettaa--pprreeffiixx variable. - RReeaaddlliinnee commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as a - repeat count. Sometimes, however, it is the sign of the argument that is - significant. Passing a negative argument to a command that acts in the - forward direction (e.g., kkiillll--lliinnee) makes that command act in a backward - direction. Commands whose behavior with arguments deviates from this are + RReeaaddlliinnee commands may be given numeric _a_r_g_u_m_e_n_t_s, which normally act as a + repeat count. Sometimes, however, it is the sign of the argument that is + significant. Passing a negative argument to a command that acts in the + forward direction (e.g., kkiillll--lliinnee) makes that command act in a backward + direction. Commands whose behavior with arguments deviates from this are noted below. The _p_o_i_n_t is the current cursor position, and _m_a_r_k refers to a saved cursor - position. The text between the point and mark is referred to as the _r_e_- + position. The text between the point and mark is referred to as the _r_e_- _g_i_o_n. RReeaaddlliinnee has the concept of an _a_c_t_i_v_e _r_e_g_i_o_n: when the region is ac- - tive, rreeaaddlliinnee redisplay highlights the region using the value of the aacc-- - ttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr variable. The eennaabbllee--aaccttiivvee--rreeggiioonn variable turns - this on and off. Several commands set the region to active; those are + tive, rreeaaddlliinnee redisplay highlights the region using the value of the aacc-- + ttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr variable. The eennaabbllee--aaccttiivvee--rreeggiioonn variable turns + this on and off. Several commands set the region to active; those are noted below. - When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved for - possible future retrieval (_y_a_n_k_i_n_g). The killed text is saved in a _k_i_l_l - _r_i_n_g. Consecutive kills accumulate the deleted text into one unit, which - can be yanked all at once. Commands which do not kill text separate the + When a command is described as _k_i_l_l_i_n_g text, the text deleted is saved for + possible future retrieval (_y_a_n_k_i_n_g). The killed text is saved in a _k_i_l_l + _r_i_n_g. Consecutive kills accumulate the deleted text into one unit, which + can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. RReeaaddlliinnee IInniittiiaalliizzaattiioonn - RReeaaddlliinnee is customized by putting commands in an initialization file (the - _i_n_p_u_t_r_c file). The name of this file is taken from the value of the - IINNPPUUTTRRCC shell variable. If that variable is unset, the default is + RReeaaddlliinnee is customized by putting commands in an initialization file (the + _i_n_p_u_t_r_c file). The name of this file is taken from the value of the + IINNPPUUTTRRCC shell variable. If that variable is unset, the default is _~_/_._i_n_p_u_t_r_c. If that file does not exist or cannot be read, rreeaaddlliinnee looks for _/_e_t_c_/_i_n_p_u_t_r_c. When a program that uses the rreeaaddlliinnee library starts up, - rreeaaddlliinnee reads the initialization file and sets the key bindings and vari- + rreeaaddlliinnee reads the initialization file and sets the key bindings and vari- ables found there, before reading any user input. - There are only a few basic constructs allowed in the inputrc file. Blank + There are only a few basic constructs allowed in the inputrc file. Blank lines are ignored. Lines beginning with a ## are comments. Lines beginning - with a $$ indicate conditional constructs. Other lines denote key bindings + with a $$ indicate conditional constructs. Other lines denote key bindings and variable settings. - The default key-bindings in this section may be changed using key binding - commands in the _i_n_p_u_t_r_c file. Programs that use the rreeaaddlliinnee library, in- + The default key-bindings in this section may be changed using key binding + commands in the _i_n_p_u_t_r_c file. Programs that use the rreeaaddlliinnee library, in- cluding bbaasshh, may add their own commands and bindings. For example, placing @@ -3553,57 +3553,57 @@ RREEAADDLLIINNEE or C-Meta-u: universal-argument - into the _i_n_p_u_t_r_c would make M-C-u execute the rreeaaddlliinnee command _u_n_i_v_e_r_- + into the _i_n_p_u_t_r_c would make M-C-u execute the rreeaaddlliinnee command _u_n_i_v_e_r_- _s_a_l_-_a_r_g_u_m_e_n_t. - Key bindings may contain the following symbolic character names: _D_E_L, _E_S_C, + Key bindings may contain the following symbolic character names: _D_E_L, _E_S_C, _E_S_C_A_P_E, _L_F_D, _N_E_W_L_I_N_E, _R_E_T, _R_E_T_U_R_N, _R_U_B_O_U_T (a destructive backspace), _S_P_A_C_E, _S_P_C, and _T_A_B. - In addition to command names, rreeaaddlliinnee allows keys to be bound to a string + In addition to command names, rreeaaddlliinnee allows keys to be bound to a string that is inserted when the key is pressed (a _m_a_c_r_o). The difference between - a macro and a command is that a macro is enclosed in single or double + a macro and a command is that a macro is enclosed in single or double quotes. RReeaaddlliinnee KKeeyy BBiinnddiinnggss The syntax for controlling key bindings in the _i_n_p_u_t_r_c file is simple. All - that is required is the name of the command or the text of a macro and a - key sequence to which it should be bound. The key sequence may be speci- - fied in one of two ways: as a symbolic key name, possibly with _M_e_t_a_- or - _C_o_n_t_r_o_l_- prefixes, or as a key sequence composed of one or more characters - enclosed in double quotes. The key sequence and name are separated by a + that is required is the name of the command or the text of a macro and a + key sequence to which it should be bound. The key sequence may be speci- + fied in one of two ways: as a symbolic key name, possibly with _M_e_t_a_- or + _C_o_n_t_r_o_l_- prefixes, or as a key sequence composed of one or more characters + enclosed in double quotes. The key sequence and name are separated by a colon. There can be no whitespace between the name and the colon. - When using the form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name of + When using the form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name of a key spelled out in English. For example: Control-u: universal-argument Meta-Rubout: backward-kill-word Control-o: "> output" - In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, - _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run - the macro expressed on the right hand side (that is, to insert the text "> + In the above example, _C_-_u is bound to the function uunniivveerrssaall--aarrgguummeenntt, + _M_-_D_E_L is bound to the function bbaacckkwwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run + the macro expressed on the right hand side (that is, to insert the text "> output" into the line). - In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs from + In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyysseeqq differs from kkeeyynnaammee above in that strings denoting an entire key sequence may be speci- - fied by placing the sequence within double quotes. Some GNU Emacs style - key escapes can be used, as in the following example, but none of the sym- + fied by placing the sequence within double quotes. Some GNU Emacs style + key escapes can be used, as in the following example, but none of the sym- bolic character names are recognized. "\C-u": universal-argument "\C-x\C-r": re-read-init-file "\e[11~": "Function Key 1" - In this example, _C_-_u is again bound to the function uunniivveerrssaall--aarrgguummeenntt. - _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is + In this example, _C_-_u is again bound to the function uunniivveerrssaall--aarrgguummeenntt. + _C_-_x _C_-_r is bound to the function rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the text "Function Key 1". - The full set of GNU Emacs style escape sequences available when specifying + The full set of GNU Emacs style escape sequences available when specifying key sequences is \\CC-- A control prefix. - \\MM-- Adding the meta prefix or converting the following character + \\MM-- Adding the meta prefix or converting the following character to a meta character, as described below under ffoorrccee--mmeettaa--pprree-- ffiixx. \\ee An escape character. @@ -3611,7 +3611,7 @@ RREEAADDLLIINNEE \\"" Literal ", a double quote. \\'' Literal ', a single quote. - In addition to the GNU Emacs style escape sequences, a second set of back- + In addition to the GNU Emacs style escape sequences, a second set of back- slash escapes is available: \\aa alert (bell) \\bb backspace @@ -3621,24 +3621,24 @@ RREEAADDLLIINNEE \\rr carriage return \\tt horizontal tab \\vv vertical tab - \\_n_n_n The eight-bit character whose value is the octal value _n_n_n + \\_n_n_n The eight-bit character whose value is the octal value _n_n_n (one to three digits). - \\xx_H_H The eight-bit character whose value is the hexadecimal value + \\xx_H_H The eight-bit character whose value is the hexadecimal value _H_H (one or two hex digits). - When entering the text of a macro, single or double quotes must be used to - indicate a macro definition. Unquoted text is assumed to be a function - name. The backslash escapes described above are expanded in the macro - body. Backslash quotes any other character in the macro text, including " + When entering the text of a macro, single or double quotes must be used to + indicate a macro definition. Unquoted text is assumed to be a function + name. The backslash escapes described above are expanded in the macro + body. Backslash quotes any other character in the macro text, including " and '. BBaasshh will display or modify the current rreeaaddlliinnee key bindings with the bbiinndd - builtin command. The --oo eemmaaccss or --oo vvii options to the sseett builtin (see - SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) change the editing mode during interactive + builtin command. The --oo eemmaaccss or --oo vvii options to the sseett builtin (see + SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) change the editing mode during interactive use. RReeaaddlliinnee VVaarriiaabblleess - RReeaaddlliinnee has variables that can be used to further customize its behavior. + RReeaaddlliinnee has variables that can be used to further customize its behavior. A variable may be set in the _i_n_p_u_t_r_c file with a statement of the form sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e @@ -3646,58 +3646,58 @@ RREEAADDLLIINNEE or using the bbiinndd builtin command (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). Except where noted, rreeaaddlliinnee variables can take the values OOnn or OOffff (with- - out regard to case). Unrecognized variable names are ignored. When rreeaadd-- + out regard to case). Unrecognized variable names are ignored. When rreeaadd-- lliinnee reads a variable value, empty or null values, "on" (case-insensitive), and "1" are equivalent to OOnn. All other values are equivalent to OOffff. - The bbiinndd --VV command lists the current rreeaaddlliinnee variable names and values + The bbiinndd --VV command lists the current rreeaaddlliinnee variable names and values (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The variables and their default values are: aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr - A string variable that controls the text color and background when + A string variable that controls the text color and background when displaying the text in the active region (see the description of eenn-- - aabbllee--aaccttiivvee--rreeggiioonn below). This string must not take up any physi- + aabbllee--aaccttiivvee--rreeggiioonn below). This string must not take up any physi- cal character positions on the display, so it should consist only of terminal escape sequences. It is output to the terminal before dis- - playing the text in the active region. This variable is reset to - the default value whenever the terminal type changes. The default - value is the string that puts the terminal in standout mode, as ob- - tained from the terminal's terminfo description. A sample value + playing the text in the active region. This variable is reset to + the default value whenever the terminal type changes. The default + value is the string that puts the terminal in standout mode, as ob- + tained from the terminal's terminfo description. A sample value might be "\e[01;33m". aaccttiivvee--rreeggiioonn--eenndd--ccoolloorr - A string variable that "undoes" the effects of aaccttiivvee--rree-- - ggiioonn--ssttaarrtt--ccoolloorr and restores "normal" terminal display appearance - after displaying text in the active region. This string must not - take up any physical character positions on the display, so it - should consist only of terminal escape sequences. It is output to - the terminal after displaying the text in the active region. This - variable is reset to the default value whenever the terminal type + A string variable that "undoes" the effects of aaccttiivvee--rree-- + ggiioonn--ssttaarrtt--ccoolloorr and restores "normal" terminal display appearance + after displaying text in the active region. This string must not + take up any physical character positions on the display, so it + should consist only of terminal escape sequences. It is output to + the terminal after displaying the text in the active region. This + variable is reset to the default value whenever the terminal type changes. The default value is the string that restores the terminal - from standout mode, as obtained from the terminal's terminfo de- + from standout mode, as obtained from the terminal's terminfo de- scription. A sample value might be "\e[0m". bbeellll--ssttyyllee ((aauuddiibbllee)) Controls what happens when rreeaaddlliinnee wants to ring the terminal bell. - If set to nnoonnee, rreeaaddlliinnee never rings the bell. If set to vviissiibbllee, - rreeaaddlliinnee uses a visible bell if one is available. If set to aauuddii-- + If set to nnoonnee, rreeaaddlliinnee never rings the bell. If set to vviissiibbllee, + rreeaaddlliinnee uses a visible bell if one is available. If set to aauuddii-- bbllee, rreeaaddlliinnee attempts to ring the terminal's bell. bbiinndd--ttttyy--ssppeecciiaall--cchhaarrss ((OOnn)) - If set to OOnn, rreeaaddlliinnee attempts to bind the control characters that + If set to OOnn, rreeaaddlliinnee attempts to bind the control characters that are treated specially by the kernel's terminal driver to their rreeaadd-- - lliinnee equivalents. These override the default rreeaaddlliinnee bindings de- - scribed here. Type "stty -a" at a bbaasshh prompt to see your current + lliinnee equivalents. These override the default rreeaaddlliinnee bindings de- + scribed here. Type "stty -a" at a bbaasshh prompt to see your current terminal settings, including the special control characters (usually - cccchhaarrss). This binding takes place on each call to rreeaaddlliinnee, so + cccchhaarrss). This binding takes place on each call to rreeaaddlliinnee, so changes made by "stty" can take effect. bblliinnkk--mmaattcchhiinngg--ppaarreenn ((OOffff)) - If set to OOnn, rreeaaddlliinnee attempts to briefly move the cursor to an + If set to OOnn, rreeaaddlliinnee attempts to briefly move the cursor to an opening parenthesis when a closing parenthesis is inserted. ccoolloorreedd--ccoommpplleettiioonn--pprreeffiixx ((OOffff)) If set to OOnn, when listing completions, rreeaaddlliinnee displays the common - prefix of the set of possible completions using a different color. - The color definitions are taken from the value of the LLSS__CCOOLLOORRSS en- - vironment variable. If there is a color definition in $$LLSS__CCOOLLOORRSS + prefix of the set of possible completions using a different color. + The color definitions are taken from the value of the LLSS__CCOOLLOORRSS en- + vironment variable. If there is a color definition in $$LLSS__CCOOLLOORRSS for the custom suffix "readline-colored-completion-prefix", rreeaaddlliinnee uses this color for the common prefix instead of its default. ccoolloorreedd--ssttaattss ((OOffff)) @@ -3705,179 +3705,179 @@ RREEAADDLLIINNEE colors to indicate their file type. The color definitions are taken from the value of the LLSS__CCOOLLOORRSS environment variable. ccoommmmeenntt--bbeeggiinn (("##")) - The string that the rreeaaddlliinnee iinnsseerrtt--ccoommmmeenntt command inserts. This + The string that the rreeaaddlliinnee iinnsseerrtt--ccoommmmeenntt command inserts. This command is bound to MM--## in emacs mode and to ## in vi command mode. ccoommpplleettiioonn--ddiissppllaayy--wwiiddtthh ((--11)) - The number of screen columns used to display possible matches when + The number of screen columns used to display possible matches when performing completion. The value is ignored if it is less than 0 or greater than the terminal screen width. A value of 0 causes matches to be displayed one per line. The default value is -1. ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff)) - If set to OOnn, rreeaaddlliinnee performs filename matching and completion in + If set to OOnn, rreeaaddlliinnee performs filename matching and completion in a case-insensitive fashion. ccoommpplleettiioonn--mmaapp--ccaassee ((OOffff)) If set to OOnn, and ccoommpplleettiioonn--iiggnnoorree--ccaassee is enabled, rreeaaddlliinnee treats - hyphens (_-) and underscores (__) as equivalent when performing + hyphens (_-) and underscores (__) as equivalent when performing case-insensitive filename matching and completion. ccoommpplleettiioonn--pprreeffiixx--ddiissppllaayy--lleennggtthh ((00)) - The maximum length in characters of the common prefix of a list of - possible completions that is displayed without modification. When - set to a value greater than zero, rreeaaddlliinnee replaces common prefixes - longer than this value with an ellipsis when displaying possible - completions. If a completion begins with a period, and eeaaddlliinnee is + The maximum length in characters of the common prefix of a list of + possible completions that is displayed without modification. When + set to a value greater than zero, rreeaaddlliinnee replaces common prefixes + longer than this value with an ellipsis when displaying possible + completions. If a completion begins with a period, and eeaaddlliinnee is completing filenames, it uses three underscores instead of an ellip- sis. ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000)) This determines when the user is queried about viewing the number of - possible completions generated by the ppoossssiibbllee--ccoommpplleettiioonnss command. - It may be set to any integer value greater than or equal to zero. - If the number of possible completions is greater than or equal to - the value of this variable, rreeaaddlliinnee asks whether or not the user - wishes to view them; otherwise rreeaaddlliinnee simply lists them on the - terminal. A zero value means rreeaaddlliinnee should never ask; negative + possible completions generated by the ppoossssiibbllee--ccoommpplleettiioonnss command. + It may be set to any integer value greater than or equal to zero. + If the number of possible completions is greater than or equal to + the value of this variable, rreeaaddlliinnee asks whether or not the user + wishes to view them; otherwise rreeaaddlliinnee simply lists them on the + terminal. A zero value means rreeaaddlliinnee should never ask; negative values are treated as zero. ccoonnvveerrtt--mmeettaa ((OOnn)) - If set to OOnn, rreeaaddlliinnee converts characters it reads that have the - eighth bit set to an ASCII key sequence by clearing the eighth bit - and prefixing it with an escape character (converting the character - to have the meta prefix). The default is _O_n, but rreeaaddlliinnee sets it + If set to OOnn, rreeaaddlliinnee converts characters it reads that have the + eighth bit set to an ASCII key sequence by clearing the eighth bit + and prefixing it with an escape character (converting the character + to have the meta prefix). The default is _O_n, but rreeaaddlliinnee sets it to _O_f_f if the locale contains characters whose encodings may include - bytes with the eighth bit set. This variable is dependent on the - LLCC__CCTTYYPPEE locale category, and may change if the locale changes. - This variable also affects key bindings; see the description of + bytes with the eighth bit set. This variable is dependent on the + LLCC__CCTTYYPPEE locale category, and may change if the locale changes. + This variable also affects key bindings; see the description of ffoorrccee--mmeettaa--pprreeffiixx below. ddiissaabbllee--ccoommpplleettiioonn ((OOffff)) If set to OOnn, rreeaaddlliinnee inhibits word completion. Completion charac- - ters are inserted into the line as if they had been mapped to sseellff-- + ters are inserted into the line as if they had been mapped to sseellff-- iinnsseerrtt. eecchhoo--ccoonnttrrooll--cchhaarraacctteerrss ((OOnn)) - When set to OOnn, on operating systems that indicate they support it, + When set to OOnn, on operating systems that indicate they support it, rreeaaddlliinnee echoes a character corresponding to a signal generated from the keyboard. eeddiittiinngg--mmooddee ((eemmaaccss)) - Controls whether rreeaaddlliinnee uses a set of key bindings similar to + Controls whether rreeaaddlliinnee uses a set of key bindings similar to _E_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can be set to either eemmaaccss or vvii. eemmaaccss--mmooddee--ssttrriinngg ((@@)) - If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is dis- - played immediately before the last line of the primary prompt when - emacs editing mode is active. The value is expanded like a key - binding, so the standard set of meta- and control- prefixes and - backslash escape sequences is available. The \1 and \2 escapes be- - gin and end sequences of non-printing characters, which can be used + If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is dis- + played immediately before the last line of the primary prompt when + emacs editing mode is active. The value is expanded like a key + binding, so the standard set of meta- and control- prefixes and + backslash escape sequences is available. The \1 and \2 escapes be- + gin and end sequences of non-printing characters, which can be used to embed a terminal control sequence into the mode string. eennaabbllee--aaccttiivvee--rreeggiioonn ((OOnn)) When this variable is set to _O_n, rreeaaddlliinnee allows certain commands to designate the region as _a_c_t_i_v_e. When the region is active, rreeaaddlliinnee - highlights the text in the region using the value of the aaccttiivvee--rree-- + highlights the text in the region using the value of the aaccttiivvee--rree-- ggiioonn--ssttaarrtt--ccoolloorr variable, which defaults to the string that enables - the terminal's standout mode. The active region shows the text in- + the terminal's standout mode. The active region shows the text in- serted by bracketed-paste and any matching text found by incremental and non-incremental history searches. eennaabbllee--bbrraacckkeetteedd--ppaassttee ((OOnn)) - When set to OOnn, rreeaaddlliinnee configures the terminal to insert each - paste into the editing buffer as a single string of characters, in- - stead of treating each character as if it had been read from the + When set to OOnn, rreeaaddlliinnee configures the terminal to insert each + paste into the editing buffer as a single string of characters, in- + stead of treating each character as if it had been read from the keyboard. This is called _b_r_a_c_k_e_t_e_d_-_p_a_s_t_e _m_o_d_e; it prevents rreeaaddlliinnee from executing any editing commands bound to key sequences appearing in the pasted text. eennaabbllee--kkeeyyppaadd ((OOffff)) - When set to OOnn, rreeaaddlliinnee tries to enable the application keypad + When set to OOnn, rreeaaddlliinnee tries to enable the application keypad when it is called. Some systems need this to enable the arrow keys. eennaabbllee--mmeettaa--kkeeyy ((OOnn)) - When set to OOnn, rreeaaddlliinnee tries to enable any meta modifier key the + When set to OOnn, rreeaaddlliinnee tries to enable any meta modifier key the terminal claims to support. On many terminals, the Meta key is used - to send eight-bit characters; this variable checks for the terminal + to send eight-bit characters; this variable checks for the terminal capability that indicates the terminal can enable and disable a mode - that sets the eighth bit of a character (0200) if the Meta key is + that sets the eighth bit of a character (0200) if the Meta key is held down when the character is typed (a meta character). eexxppaanndd--ttiillddee ((OOffff)) - If set to OOnn, rreeaaddlliinnee performs tilde expansion when it attempts + If set to OOnn, rreeaaddlliinnee performs tilde expansion when it attempts word completion. ffoorrccee--mmeettaa--pprreeffiixx ((OOffff)) - If set to OOnn, rreeaaddlliinnee modifies its behavior when binding key se- + If set to OOnn, rreeaaddlliinnee modifies its behavior when binding key se- quences containing \M- or Meta- (see KKeeyy BBiinnddiinnggss above) by convert- - ing a key sequence of the form \M-_C or Meta-_C to the two-character - sequence EESSCC _C (adding the meta prefix). If ffoorrccee--mmeettaa--pprreeffiixx is - set to OOffff (the default), rreeaaddlliinnee uses the value of the ccoonn-- - vveerrtt--mmeettaa variable to determine whether to perform this conversion: - if ccoonnvveerrtt--mmeettaa is OOnn, rreeaaddlliinnee performs the conversion described + ing a key sequence of the form \M-_C or Meta-_C to the two-character + sequence EESSCC _C (adding the meta prefix). If ffoorrccee--mmeettaa--pprreeffiixx is + set to OOffff (the default), rreeaaddlliinnee uses the value of the ccoonn-- + vveerrtt--mmeettaa variable to determine whether to perform this conversion: + if ccoonnvveerrtt--mmeettaa is OOnn, rreeaaddlliinnee performs the conversion described above; if it is OOffff, rreeaaddlliinnee converts _C to a meta character by set- ting the eighth bit (0200). hhiissttoorryy--pprreesseerrvvee--ppooiinntt ((OOffff)) - If set to OOnn, the history code attempts to place point at the same - location on each history line retrieved with pprreevviioouuss--hhiissttoorryy or + If set to OOnn, the history code attempts to place point at the same + location on each history line retrieved with pprreevviioouuss--hhiissttoorryy or nneexxtt--hhiissttoorryy. hhiissttoorryy--ssiizzee ((uunnsseett)) Set the maximum number of history entries saved in the history list. - If set to zero, any existing history entries are deleted and no new - entries are saved. If set to a value less than zero, the number of - history entries is not limited. By default, bbaasshh sets the maximum - number of history entries to the value of the HHIISSTTSSIIZZEE shell vari- + If set to zero, any existing history entries are deleted and no new + entries are saved. If set to a value less than zero, the number of + history entries is not limited. By default, bbaasshh sets the maximum + number of history entries to the value of the HHIISSTTSSIIZZEE shell vari- able. Setting _h_i_s_t_o_r_y_-_s_i_z_e to a non-numeric value will set the max- imum number of history entries to 500. hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff)) - Setting this variable to OOnn makes rreeaaddlliinnee use a single line for - display, scrolling the input horizontally on a single screen line + Setting this variable to OOnn makes rreeaaddlliinnee use a single line for + display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to - a new line. This setting is automatically enabled for terminals of + a new line. This setting is automatically enabled for terminals of height 1. iinnppuutt--mmeettaa ((OOffff)) If set to OOnn, rreeaaddlliinnee enables eight-bit input (that is, it does not clear the eighth bit in the characters it reads), regardless of what - the terminal claims it can support. The default is _O_f_f, but rreeaadd-- + the terminal claims it can support. The default is _O_f_f, but rreeaadd-- lliinnee sets it to _O_n if the locale contains characters whose encodings - may include bytes with the eighth bit set. This variable is depen- - dent on the LLCC__CCTTYYPPEE locale category, and its value may change if + may include bytes with the eighth bit set. This variable is depen- + dent on the LLCC__CCTTYYPPEE locale category, and its value may change if the locale changes. The name mmeettaa--ffllaagg is a synonym for iinnppuutt--mmeettaa. iisseeaarrcchh--tteerrmmiinnaattoorrss (("CC--[[CC--jj")) The string of characters that should terminate an incremental search - without subsequently executing the character as a command. If this + without subsequently executing the character as a command. If this variable has not been given a value, the characters _E_S_C and CC--jj ter- minate an incremental search. kkeeyymmaapp ((eemmaaccss)) - Set the current rreeaaddlliinnee keymap. The set of valid keymap names is - _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_c_o_m_m_a_n_d, and - _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is equivalent to - _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the value of eeddiitt-- + Set the current rreeaaddlliinnee keymap. The set of valid keymap names is + _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_c_o_m_m_a_n_d, and + _v_i_-_i_n_s_e_r_t. _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is equivalent to + _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the value of eeddiitt-- iinngg--mmooddee also affects the default keymap. kkeeyysseeqq--ttiimmeeoouutt ((550000)) Specifies the duration rreeaaddlliinnee will wait for a character when read- - ing an ambiguous key sequence (one that can form a complete key se- - quence using the input read so far, or can take additional input to - complete a longer key sequence). If rreeaaddlliinnee does not receive any - input within the timeout, it uses the shorter but complete key se- - quence. The value is specified in milliseconds, so a value of 1000 - means that rreeaaddlliinnee will wait one second for additional input. If - this variable is set to a value less than or equal to zero, or to a - non-numeric value, rreeaaddlliinnee waits until another key is pressed to + ing an ambiguous key sequence (one that can form a complete key se- + quence using the input read so far, or can take additional input to + complete a longer key sequence). If rreeaaddlliinnee does not receive any + input within the timeout, it uses the shorter but complete key se- + quence. The value is specified in milliseconds, so a value of 1000 + means that rreeaaddlliinnee will wait one second for additional input. If + this variable is set to a value less than or equal to zero, or to a + non-numeric value, rreeaaddlliinnee waits until another key is pressed to decide which key sequence to complete. mmaarrkk--ddiirreeccttoorriieess ((OOnn)) If set to OOnn, completed directory names have a slash appended. mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff)) - If set to OOnn, rreeaaddlliinnee displays history lines that have been modi- + If set to OOnn, rreeaaddlliinnee displays history lines that have been modi- fied with a preceding asterisk (**). mmaarrkk--ssyymmlliinnkkeedd--ddiirreeccttoorriieess ((OOffff)) - If set to OOnn, completed names which are symbolic links to directo- - ries have a slash appended, subject to the value of mmaarrkk--ddiirreeccttoo-- + If set to OOnn, completed names which are symbolic links to directo- + ries have a slash appended, subject to the value of mmaarrkk--ddiirreeccttoo-- rriieess. mmaattcchh--hhiiddddeenn--ffiilleess ((OOnn)) - This variable, when set to OOnn, forces rreeaaddlliinnee to match files whose + This variable, when set to OOnn, forces rreeaaddlliinnee to match files whose names begin with a "." (hidden files) when performing filename com- - pletion. If set to OOffff, the user must include the leading "." in + pletion. If set to OOffff, the user must include the leading "." in the filename to be completed. mmeennuu--ccoommpplleettee--ddiissppllaayy--pprreeffiixx ((OOffff)) If set to OOnn, menu completion displays the common prefix of the list - of possible completions (which may be empty) before cycling through + of possible completions (which may be empty) before cycling through the list. oouuttppuutt--mmeettaa ((OOffff)) - If set to OOnn, rreeaaddlliinnee displays characters with the eighth bit set - directly rather than as a meta-prefixed escape sequence. The de- - fault is _O_f_f, but rreeaaddlliinnee sets it to _O_n if the locale contains - characters whose encodings may include bytes with the eighth bit - set. This variable is dependent on the LLCC__CCTTYYPPEE locale category, + If set to OOnn, rreeaaddlliinnee displays characters with the eighth bit set + directly rather than as a meta-prefixed escape sequence. The de- + fault is _O_f_f, but rreeaaddlliinnee sets it to _O_n if the locale contains + characters whose encodings may include bytes with the eighth bit + set. This variable is dependent on the LLCC__CCTTYYPPEE locale category, and its value may change if the locale changes. ppaaggee--ccoommpplleettiioonnss ((OOnn)) - If set to OOnn, rreeaaddlliinnee uses an internal pager resembling _m_o_r_e(1) to + If set to OOnn, rreeaaddlliinnee uses an internal pager resembling _m_o_r_e(1) to display a screenful of possible completions at a time. pprreeffeerr--vviissiibbllee--bbeellll See bbeellll--ssttyyllee. @@ -3887,92 +3887,92 @@ RREEAADDLLIINNEE rreevveerrtt--aallll--aatt--nneewwlliinnee ((OOffff)) If set to OOnn, rreeaaddlliinnee will undo all changes to history lines before returning when executing aacccceepptt--lliinnee. By default, history lines may - be modified and retain individual undo lists across calls to rreeaadd-- + be modified and retain individual undo lists across calls to rreeaadd-- lliinnee. sseeaarrcchh--iiggnnoorree--ccaassee ((OOffff)) If set to OOnn, rreeaaddlliinnee performs incremental and non-incremental his- tory list searches in a case-insensitive fashion. sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff)) - This alters the default behavior of the completion functions. If - set to OOnn, words which have more than one possible completion cause + This alters the default behavior of the completion functions. If + set to OOnn, words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell. sshhooww--aallll--iiff--uunnmmooddiiffiieedd ((OOffff)) - This alters the default behavior of the completion functions in a + This alters the default behavior of the completion functions in a fashion similar to sshhooww--aallll--iiff--aammbbiigguuoouuss. If set to OOnn, words which - have more than one possible completion without any possible partial - completion (the possible completions don't share a common prefix) - cause the matches to be listed immediately instead of ringing the + have more than one possible completion without any possible partial + completion (the possible completions don't share a common prefix) + cause the matches to be listed immediately instead of ringing the bell. sshhooww--mmooddee--iinn--pprroommpptt ((OOffff)) If set to OOnn, add a string to the beginning of the prompt indicating - the editing mode: emacs, vi command, or vi insertion. The mode + the editing mode: emacs, vi command, or vi insertion. The mode strings are user-settable (e.g., _e_m_a_c_s_-_m_o_d_e_-_s_t_r_i_n_g). sskkiipp--ccoommpplleetteedd--tteexxtt ((OOffff)) - If set to OOnn, this alters the default completion behavior when in- - serting a single match into the line. It's only active when per- - forming completion in the middle of a word. If enabled, rreeaaddlliinnee + If set to OOnn, this alters the default completion behavior when in- + serting a single match into the line. It's only active when per- + forming completion in the middle of a word. If enabled, rreeaaddlliinnee does not insert characters from the completion that match characters - after point in the word being completed, so portions of the word + after point in the word being completed, so portions of the word following the cursor are not duplicated. vvii--ccmmdd--mmooddee--ssttrriinngg ((((ccmmdd)))) - If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is dis- - played immediately before the last line of the primary prompt when - vi editing mode is active and in command mode. The value is ex- - panded like a key binding, so the standard set of meta- and control- - prefixes and backslash escape sequences is available. The \1 and \2 - escapes begin and end sequences of non-printing characters, which - can be used to embed a terminal control sequence into the mode - string. - vvii--iinnss--mmooddee--ssttrriinngg ((((iinnss)))) If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is dis- played immediately before the last line of the primary prompt when - vi editing mode is active and in insertion mode. The value is ex- + vi editing mode is active and in command mode. The value is ex- panded like a key binding, so the standard set of meta- and control- prefixes and backslash escape sequences is available. The \1 and \2 escapes begin and end sequences of non-printing characters, which can be used to embed a terminal control sequence into the mode string. + vvii--iinnss--mmooddee--ssttrriinngg ((((iinnss)))) + If the _s_h_o_w_-_m_o_d_e_-_i_n_-_p_r_o_m_p_t variable is enabled, this string is dis- + played immediately before the last line of the primary prompt when + vi editing mode is active and in insertion mode. The value is ex- + panded like a key binding, so the standard set of meta- and control- + prefixes and backslash escape sequences is available. The \1 and \2 + escapes begin and end sequences of non-printing characters, which + can be used to embed a terminal control sequence into the mode + string. vviissiibbllee--ssttaattss ((OOffff)) - If set to OOnn, a character denoting a file's type as reported by - _s_t_a_t(2) is appended to the filename when listing possible comple- + If set to OOnn, a character denoting a file's type as reported by + _s_t_a_t(2) is appended to the filename when listing possible comple- tions. RReeaaddlliinnee CCoonnddiittiioonnaall CCoonnssttrruuccttss - RReeaaddlliinnee implements a facility similar in spirit to the conditional compi- - lation features of the C preprocessor which allows key bindings and vari- - able settings to be performed as the result of tests. There are four + RReeaaddlliinnee implements a facility similar in spirit to the conditional compi- + lation features of the C preprocessor which allows key bindings and vari- + able settings to be performed as the result of tests. There are four parser directives available. - $$iiff The $$iiff construct allows bindings to be made based on the editing - mode, the terminal being used, or the application using rreeaaddlliinnee. - The text of the test, after any comparison operator, extends to the - end of the line; unless otherwise noted, no characters are required + $$iiff The $$iiff construct allows bindings to be made based on the editing + mode, the terminal being used, or the application using rreeaaddlliinnee. + The text of the test, after any comparison operator, extends to the + end of the line; unless otherwise noted, no characters are required to isolate it. - mmooddee The mmooddee== form of the $$iiff directive is used to test whether - rreeaaddlliinnee is in emacs or vi mode. This may be used in con- - junction with the sseett kkeeyymmaapp command, for instance, to set + mmooddee The mmooddee== form of the $$iiff directive is used to test whether + rreeaaddlliinnee is in emacs or vi mode. This may be used in con- + junction with the sseett kkeeyymmaapp command, for instance, to set bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_-_c_t_l_x keymaps only if rreeaaddlliinnee is starting out in emacs mode. - tteerrmm The tteerrmm== form may be used to include terminal-specific key - bindings, perhaps to bind the key sequences output by the - terminal's function keys. The word on the right side of the - == is tested against both the full name of the terminal and - the portion of the terminal name before the first --. This - allows _x_t_e_r_m to match both _x_t_e_r_m and _x_t_e_r_m_-_2_5_6_c_o_l_o_r, for in- + tteerrmm The tteerrmm== form may be used to include terminal-specific key + bindings, perhaps to bind the key sequences output by the + terminal's function keys. The word on the right side of the + == is tested against both the full name of the terminal and + the portion of the terminal name before the first --. This + allows _x_t_e_r_m to match both _x_t_e_r_m and _x_t_e_r_m_-_2_5_6_c_o_l_o_r, for in- stance. vveerrssiioonn - The vveerrssiioonn test may be used to perform comparisons against - specific rreeaaddlliinnee versions. The vveerrssiioonn expands to the cur- - rent rreeaaddlliinnee version. The set of comparison operators in- + The vveerrssiioonn test may be used to perform comparisons against + specific rreeaaddlliinnee versions. The vveerrssiioonn expands to the cur- + rent rreeaaddlliinnee version. The set of comparison operators in- cludes ==, (and ====), !!==, <<==, >>==, <<, and >>. The version number - supplied on the right side of the operator consists of a ma- - jor version number, an optional decimal point, and an op- - tional minor version (e.g., 77..11). If the minor version is - omitted, it defaults to 00. The operator may be separated - from the string vveerrssiioonn and from the version number argument + supplied on the right side of the operator consists of a ma- + jor version number, an optional decimal point, and an op- + tional minor version (e.g., 77..11). If the minor version is + omitted, it defaults to 00. The operator may be separated + from the string vveerrssiioonn and from the version number argument by whitespace. _a_p_p_l_i_c_a_t_i_o_n @@ -3980,8 +3980,8 @@ RREEAADDLLIINNEE cific settings. Each program using the rreeaaddlliinnee library sets the _a_p_p_l_i_c_a_t_i_o_n _n_a_m_e, and an initialization file can test for a particular value. This could be used to bind key sequences - to functions useful for a specific program. For instance, - the following command adds a key sequence that quotes the + to functions useful for a specific program. For instance, + the following command adds a key sequence that quotes the current or previous word in bbaasshh: $$iiff Bash @@ -3990,83 +3990,83 @@ RREEAADDLLIINNEE $$eennddiiff _v_a_r_i_a_b_l_e - The _v_a_r_i_a_b_l_e construct provides simple equality tests for - rreeaaddlliinnee variables and values. The permitted comparison op- - erators are _=, _=_=, and _!_=. The variable name must be sepa- - rated from the comparison operator by whitespace; the opera- + The _v_a_r_i_a_b_l_e construct provides simple equality tests for + rreeaaddlliinnee variables and values. The permitted comparison op- + erators are _=, _=_=, and _!_=. The variable name must be sepa- + rated from the comparison operator by whitespace; the opera- tor may be separated from the value on the right hand side by - whitespace. String and boolean variables may be tested. - Boolean variables must be tested against the values _o_n and + whitespace. String and boolean variables may be tested. + Boolean variables must be tested against the values _o_n and _o_f_f. - $$eellssee Commands in this branch of the $$iiff directive are executed if the + $$eellssee Commands in this branch of the $$iiff directive are executed if the test fails. $$eennddiiff - This command, as seen in the previous example, terminates an $$iiff + This command, as seen in the previous example, terminates an $$iiff command. $$iinncclluuddee This directive takes a single filename as an argument and reads com- - mands and key bindings from that file. For example, the following + mands and key bindings from that file. For example, the following directive would read _/_e_t_c_/_i_n_p_u_t_r_c: $$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c SSeeaarrcchhiinngg - RReeaaddlliinnee provides commands for searching through the command history (see - HHIISSTTOORRYY below) for lines containing a specified string. There are two + RReeaaddlliinnee provides commands for searching through the command history (see + HHIISSTTOORRYY below) for lines containing a specified string. There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_t_a_l. - Incremental searches begin before the user has finished typing the search + Incremental searches begin before the user has finished typing the search string. As each character of the search string is typed, rreeaaddlliinnee displays - the next entry from the history matching the string typed so far. An in- + the next entry from the history matching the string typed so far. An in- cremental search requires only as many characters as needed to find the de- - sired history entry. When using emacs editing mode, type CC--rr to search - backward in the history for a particular string. Typing CC--ss searches for- - ward through the history. The characters present in the value of the - iisseeaarrcchh--tteerrmmiinnaattoorrss variable are used to terminate an incremental search. - If that variable has not been assigned a value, _E_S_C and CC--jj terminate an - incremental search. CC--gg aborts an incremental search and restores the + sired history entry. When using emacs editing mode, type CC--rr to search + backward in the history for a particular string. Typing CC--ss searches for- + ward through the history. The characters present in the value of the + iisseeaarrcchh--tteerrmmiinnaattoorrss variable are used to terminate an incremental search. + If that variable has not been assigned a value, _E_S_C and CC--jj terminate an + incremental search. CC--gg aborts an incremental search and restores the original line. When the search is terminated, the history entry containing the search string becomes the current line. - To find other matching entries in the history list, type CC--rr or CC--ss as ap- - propriate. This searches backward or forward in the history for the next - entry matching the search string typed so far. Any other key sequence - bound to a rreeaaddlliinnee command terminates the search and executes that com- - mand. For instance, a newline terminates the search and accepts the line, - thereby executing the command from the history list. A movement command - will terminate the search, make the last line found the current line, and + To find other matching entries in the history list, type CC--rr or CC--ss as ap- + propriate. This searches backward or forward in the history for the next + entry matching the search string typed so far. Any other key sequence + bound to a rreeaaddlliinnee command terminates the search and executes that com- + mand. For instance, a newline terminates the search and accepts the line, + thereby executing the command from the history list. A movement command + will terminate the search, make the last line found the current line, and begin editing. - RReeaaddlliinnee remembers the last incremental search string. If two CC--rrs are - typed without any intervening characters defining a new search string, + RReeaaddlliinnee remembers the last incremental search string. If two CC--rrs are + typed without any intervening characters defining a new search string, rreeaaddlliinnee uses any remembered search string. - Non-incremental searches read the entire search string before starting to + Non-incremental searches read the entire search string before starting to search for matching history entries. The search string may be typed by the user or be part of the contents of the current line. RReeaaddlliinnee CCoommmmaanndd NNaammeess - The following is a list of the names of the commands and the default key - sequences to which they are bound. Command names without an accompanying + The following is a list of the names of the commands and the default key + sequences to which they are bound. Command names without an accompanying key sequence are unbound by default. In the following descriptions, _p_o_i_n_t refers to the current cursor position, - and _m_a_r_k refers to a cursor position saved by the sseett--mmaarrkk command. The + and _m_a_r_k refers to a cursor position saved by the sseett--mmaarrkk command. The text between the point and mark is referred to as the _r_e_g_i_o_n. RReeaaddlliinnee has the concept of an _a_c_t_i_v_e _r_e_g_i_o_n: when the region is active, rreeaaddlliinnee redis- play highlights the region using the value of the aaccttiivvee--rreeggiioonn--ssttaarrtt--ccoolloorr - variable. The eennaabbllee--aaccttiivvee--rreeggiioonn rreeaaddlliinnee variable turns this on and + variable. The eennaabbllee--aaccttiivvee--rreeggiioonn rreeaaddlliinnee variable turns this on and off. Several commands set the region to active; those are noted below. CCoommmmaannddss ffoorr MMoovviinngg bbeeggiinnnniinngg--ooff--lliinnee ((CC--aa)) - Move to the start of the current line. This may also be bound to + Move to the start of the current line. This may also be bound to the Home key on some keyboards. eenndd--ooff--lliinnee ((CC--ee)) - Move to the end of the line. This may also be bound to the End key + Move to the end of the line. This may also be bound to the End key on some keyboards. ffoorrwwaarrdd--cchhaarr ((CC--ff)) Move forward a character. This may also be bound to the right arrow @@ -4078,32 +4078,32 @@ RREEAADDLLIINNEE Move forward to the end of the next word. Words are composed of al- phanumeric characters (letters and digits). bbaacckkwwaarrdd--wwoorrdd ((MM--bb)) - Move back to the start of the current or previous word. Words are + Move back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and digits). sshheellll--ffoorrwwaarrdd--wwoorrdd ((MM--CC--ff)) - Move forward to the end of the next word. Words are delimited by + Move forward to the end of the next word. Words are delimited by non-quoted shell metacharacters. sshheellll--bbaacckkwwaarrdd--wwoorrdd ((MM--CC--bb)) - Move back to the start of the current or previous word. Words are + Move back to the start of the current or previous word. Words are delimited by non-quoted shell metacharacters. pprreevviioouuss--ssccrreeeenn--lliinnee Attempt to move point to the same physical screen column on the pre- - vious physical screen line. This will not have the desired effect + vious physical screen line. This will not have the desired effect if the current rreeaaddlliinnee line does not take up more than one physical - line or if point is not greater than the length of the prompt plus + line or if point is not greater than the length of the prompt plus the screen width. nneexxtt--ssccrreeeenn--lliinnee Attempt to move point to the same physical screen column on the next - physical screen line. This will not have the desired effect if the - current rreeaaddlliinnee line does not take up more than one physical line - or if the length of the current rreeaaddlliinnee line is not greater than + physical screen line. This will not have the desired effect if the + current rreeaaddlliinnee line does not take up more than one physical line + or if the length of the current rreeaaddlliinnee line is not greater than the length of the prompt plus the screen width. cclleeaarr--ddiissppllaayy ((MM--CC--ll)) Clear the screen and, if possible, the terminal's scrollback buffer, then redraw the current line, leaving the current line at the top of the screen. cclleeaarr--ssccrreeeenn ((CC--ll)) - Clear the screen, then redraw the current line, leaving the current + Clear the screen, then redraw the current line, leaving the current line at the top of the screen. With a numeric argument, refresh the current line without clearing the screen. rreeddrraaww--ccuurrrreenntt--lliinnee @@ -4111,16 +4111,16 @@ RREEAADDLLIINNEE CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn)) - Accept the line regardless of where the cursor is. If this line is - non-empty, add it to the history list according to the state of the - HHIISSTTCCOONNTTRROOLL and HHIISSTTIIGGNNOORREE variables. If the line is a modified + Accept the line regardless of where the cursor is. If this line is + non-empty, add it to the history list according to the state of the + HHIISSTTCCOONNTTRROOLL and HHIISSTTIIGGNNOORREE variables. If the line is a modified history line, restore the history line to its original state. pprreevviioouuss--hhiissttoorryy ((CC--pp)) Fetch the previous command from the history list, moving back in the list. This may also be bound to the up arrow key on some keyboards. nneexxtt--hhiissttoorryy ((CC--nn)) - Fetch the next command from the history list, moving forward in the - list. This may also be bound to the down arrow key on some key- + Fetch the next command from the history list, moving forward in the + list. This may also be bound to the down arrow key on some key- boards. bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<)) Move to the first line in the history. @@ -4128,113 +4128,113 @@ RREEAADDLLIINNEE Move to the end of the input history, i.e., the line currently being entered. ooppeerraattee--aanndd--ggeett--nneexxtt ((CC--oo)) - Accept the current line for execution as if a newline had been en- + Accept the current line for execution as if a newline had been en- tered, and fetch the next line relative to the current line from the history for editing. A numeric argument, if supplied, specifies the history entry to use instead of the current line. ffeettcchh--hhiissttoorryy - With a numeric argument, fetch that entry from the history list and - make it the current line. Without an argument, move back to the + With a numeric argument, fetch that entry from the history list and + make it the current line. Without an argument, move back to the first entry in the history list. rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr)) Search backward starting at the current line and moving "up" through the history as necessary. This is an incremental search. This com- mand sets the region to the matched text and activates the region. ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss)) - Search forward starting at the current line and moving "down" - through the history as necessary. This is an incremental search. - This command sets the region to the matched text and activates the + Search forward starting at the current line and moving "down" + through the history as necessary. This is an incremental search. + This command sets the region to the matched text and activates the region. nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp)) Search backward through the history starting at the current line us- ing a non-incremental search for a string supplied by the user. The search string may match anywhere in a history line. nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn)) - Search forward through the history starting at the current line us- + Search forward through the history starting at the current line us- ing a non-incremental search for a string supplied by the user. The search string may match anywhere in a history line. nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy--aaggaaiinn (()) Search backward through the history starting at the current line us- - ing a non-incremental search for the last non-incremental search - string used. If there is no previous search string, this command - returns an error. The search string may match anywhere in a history - line. - nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy--aaggaaiinn (()) - Search forward through the history starting at the current line us- ing a non-incremental search for the last non-incremental search string used. If there is no previous search string, this command returns an error. The search string may match anywhere in a history line. + nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy--aaggaaiinn (()) + Search forward through the history starting at the current line us- + ing a non-incremental search for the last non-incremental search + string used. If there is no previous search string, this command + returns an error. The search string may match anywhere in a history + line. hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd Search backward through the history for the string of characters be- - tween the start of the current line and the point. The search - string must match at the beginning of a history line. This is a - non-incremental search. This may be bound to the Page Up key on + tween the start of the current line and the point. The search + string must match at the beginning of a history line. This is a + non-incremental search. This may be bound to the Page Up key on some keyboards. hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd - Search forward through the history for the string of characters be- - tween the start of the current line and the point. The search - string must match at the beginning of a history line. This is a - non-incremental search. This may be bound to the Page Down key on + Search forward through the history for the string of characters be- + tween the start of the current line and the point. The search + string must match at the beginning of a history line. This is a + non-incremental search. This may be bound to the Page Down key on some keyboards. hhiissttoorryy--ssuubbssttrriinngg--sseeaarrcchh--bbaacckkwwaarrdd Search backward through the history for the string of characters be- - tween the start of the current line and the point. The search - string may match anywhere in a history line. This is a non-incre- - mental search. - hhiissttoorryy--ssuubbssttrriinngg--sseeaarrcchh--ffoorrwwaarrdd - Search forward through the history for the string of characters be- tween the start of the current line and the point. The search string may match anywhere in a history line. This is a non-incre- mental search. + hhiissttoorryy--ssuubbssttrriinngg--sseeaarrcchh--ffoorrwwaarrdd + Search forward through the history for the string of characters be- + tween the start of the current line and the point. The search + string may match anywhere in a history line. This is a non-incre- + mental search. yyaannkk--nntthh--aarrgg ((MM--CC--yy)) - Insert the first argument to the previous command (usually the sec- + Insert the first argument to the previous command (usually the sec- ond word on the previous line) at point. With an argument _n, insert - the _nth word from the previous command (the words in the previous - command begin with word 0). A negative argument inserts the _nth - word from the end of the previous command. Once the argument _n is - computed, this uses the history expansion facilities to extract the + the _nth word from the previous command (the words in the previous + command begin with word 0). A negative argument inserts the _nth + word from the end of the previous command. Once the argument _n is + computed, this uses the history expansion facilities to extract the _nth word, as if the "!!:_n" history expansion had been specified. yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__)) - Insert the last argument to the previous command (the last word of - the previous history entry). With a numeric argument, behave ex- - actly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg move - back through the history list, inserting the last word (or the word - specified by the argument to the first call) of each line in turn. - Any numeric argument supplied to these successive calls determines - the direction to move through the history. A negative argument - switches the direction through the history (back or forward). This - uses the history expansion facilities to extract the last word, as + Insert the last argument to the previous command (the last word of + the previous history entry). With a numeric argument, behave ex- + actly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg move + back through the history list, inserting the last word (or the word + specified by the argument to the first call) of each line in turn. + Any numeric argument supplied to these successive calls determines + the direction to move through the history. A negative argument + switches the direction through the history (back or forward). This + uses the history expansion facilities to extract the last word, as if the "!$" history expansion had been specified. sshheellll--eexxppaanndd--lliinnee ((MM--CC--ee)) - Expand the line by performing shell word expansions, treating the + Expand the line by performing shell word expansions, treating the line as a single shell word. This performs alias and history expan- - sion, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting, tilde expansion, parameter - and variable expansion, arithmetic expansion, command and process - substitution, word splitting, and quote removal. An explicit argu- - ment suppresses command and process substitution. See HHIISSTTOORRYY EEXX-- + sion, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting, tilde expansion, parameter + and variable expansion, arithmetic expansion, command and process + substitution, word splitting, and quote removal. An explicit argu- + ment suppresses command and process substitution. See HHIISSTTOORRYY EEXX-- PPAANNSSIIOONN below for a description of history expansion. sshheellll--eexxppaanndd--aanndd--rreeqquuoottee--lliinnee (()) - Expand the line by performing shell word expansions, splitting the - line into shell words in the same way as for programmable comple- - tion. This performs alias and history expansion, $$'_s_t_r_i_n_g' and - $$"_s_t_r_i_n_g" quoting, tilde expansion, parameter and variable expan- - sion, arithmetic expansion, command and process substitution, word + Expand the line by performing shell word expansions, splitting the + line into shell words in the same way as for programmable comple- + tion. This performs alias and history expansion, $$'_s_t_r_i_n_g' and + $$"_s_t_r_i_n_g" quoting, tilde expansion, parameter and variable expan- + sion, arithmetic expansion, command and process substitution, word splitting, and quote removal on each word, then quotes the resulting - words if necessary to prevent further expansion. An explicit argu- + words if necessary to prevent further expansion. An explicit argu- ment suppresses command and process substitution and quotes each re- - sultant word. As usual, double-quoting a word will suppress word - splitting. This can be useful when combined with suppressing com- + sultant word. As usual, double-quoting a word will suppress word + splitting. This can be useful when combined with suppressing com- mand substitution, for instance, so the words in the command substi- tution aren't quoted individually. hhiissttoorryy--eexxppaanndd--lliinnee ((MM--^^)) - Perform history expansion on the current line. See HHIISSTTOORRYY EEXXPPAANN-- + Perform history expansion on the current line. See HHIISSTTOORRYY EEXXPPAANN-- SSIIOONN below for a description of history expansion. mmaaggiicc--ssppaaccee - Perform history expansion on the current line and insert a space. + Perform history expansion on the current line and insert a space. See HHIISSTTOORRYY EEXXPPAANNSSIIOONN below for a description of history expansion. aalliiaass--eexxppaanndd--lliinnee - Perform alias expansion on the current line. See AALLIIAASSEESS above for + Perform alias expansion on the current line. See AALLIIAASSEESS above for a description of alias expansion. hhiissttoorryy--aanndd--aalliiaass--eexxppaanndd--lliinnee Perform history and alias expansion on the current line. @@ -4242,252 +4242,252 @@ RREEAADDLLIINNEE A synonym for yyaannkk--llaasstt--aarrgg. eeddiitt--aanndd--eexxeeccuuttee--ccoommmmaanndd ((CC--xx CC--ee)) Invoke an editor on the current command line, and execute the result - as shell commands. BBaasshh attempts to invoke $$VVIISSUUAALL, $$EEDDIITTOORR, and + as shell commands. BBaasshh attempts to invoke $$VVIISSUUAALL, $$EEDDIITTOORR, and _e_m_a_c_s as the editor, in that order. CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt _e_n_d_-_o_f_-_f_i_l_e ((uussuuaallllyy CC--dd)) The character indicating end-of-file as set, for example, by - _s_t_t_y(1). If this character is read when there are no characters on + _s_t_t_y(1). If this character is read when there are no characters on the line, and point is at the beginning of the line, rreeaaddlliinnee inter- prets it as the end of input and returns EEOOFF. ddeelleettee--cchhaarr ((CC--dd)) - Delete the character at point. If this function is bound to the - same character as the tty EEOOFF character, as CC--dd commonly is, see - above for the effects. This may also be bound to the Delete key on + Delete the character at point. If this function is bound to the + same character as the tty EEOOFF character, as CC--dd commonly is, see + above for the effects. This may also be bound to the Delete key on some keyboards. bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt)) - Delete the character behind the cursor. When given a numeric argu- + Delete the character behind the cursor. When given a numeric argu- ment, save the deleted text on the kill ring. ffoorrwwaarrdd--bbaacckkwwaarrdd--ddeelleettee--cchhaarr - Delete the character under the cursor, unless the cursor is at the - end of the line, in which case the character behind the cursor is + Delete the character under the cursor, unless the cursor is at the + end of the line, in which case the character behind the cursor is deleted. qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv)) - Add the next character typed to the line verbatim. This is how to + Add the next character typed to the line verbatim. This is how to insert characters like CC--qq, for example. ttaabb--iinnsseerrtt ((CC--vv TTAABB)) Insert a tab character. sseellff--iinnsseerrtt ((aa,, bb,, AA,, 11,, !!,, ...)) Insert the character typed. bbrraacckkeetteedd--ppaassttee--bbeeggiinn - This function is intended to be bound to the "bracketed paste" es- + This function is intended to be bound to the "bracketed paste" es- cape sequence sent by some terminals, and such a binding is assigned - by default. It allows rreeaaddlliinnee to insert the pasted text as a sin- + by default. It allows rreeaaddlliinnee to insert the pasted text as a sin- gle unit without treating each character as if it had been read from the keyboard. The pasted characters are inserted as if each one was bound to sseellff--iinnsseerrtt instead of executing any editing commands. - Bracketed paste sets the region to the inserted text and activates + Bracketed paste sets the region to the inserted text and activates the region. ttrraannssppoossee--cchhaarrss ((CC--tt)) Drag the character before point forward over the character at point, - moving point forward as well. If point is at the end of the line, - then this transposes the two characters before point. Negative ar- + moving point forward as well. If point is at the end of the line, + then this transposes the two characters before point. Negative ar- guments have no effect. ttrraannssppoossee--wwoorrddss ((MM--tt)) - Drag the word before point past the word after point, moving point - past that word as well. If point is at the end of the line, this + Drag the word before point past the word after point, moving point + past that word as well. If point is at the end of the line, this transposes the last two words on the line. sshheellll--ttrraannssppoossee--wwoorrddss ((MM--CC--tt)) - Drag the word before point past the word after point, moving point + Drag the word before point past the word after point, moving point past that word as well. If the insertion point is at the end of the - line, this transposes the last two words on the line. Word bound- + line, this transposes the last two words on the line. Word bound- aries are the same as sshheellll--ffoorrwwaarrdd--wwoorrdd and sshheellll--bbaacckkwwaarrdd--wwoorrdd. uuppccaassee--wwoorrdd ((MM--uu)) - Uppercase the current (or following) word. With a negative argu- + Uppercase the current (or following) word. With a negative argu- ment, uppercase the previous word, but do not move point. ddoowwnnccaassee--wwoorrdd ((MM--ll)) - Lowercase the current (or following) word. With a negative argu- + Lowercase the current (or following) word. With a negative argu- ment, lowercase the previous word, but do not move point. ccaappiittaalliizzee--wwoorrdd ((MM--cc)) - Capitalize the current (or following) word. With a negative argu- + Capitalize the current (or following) word. With a negative argu- ment, capitalize the previous word, but do not move point. oovveerrwwrriittee--mmooddee - Toggle overwrite mode. With an explicit positive numeric argument, - switches to overwrite mode. With an explicit non-positive numeric - argument, switches to insert mode. This command affects only eemmaaccss - mode; vvii mode does overwrite differently. Each call to _r_e_a_d_l_i_n_e_(_) + Toggle overwrite mode. With an explicit positive numeric argument, + switches to overwrite mode. With an explicit non-positive numeric + argument, switches to insert mode. This command affects only eemmaaccss + mode; vvii mode does overwrite differently. Each call to _r_e_a_d_l_i_n_e_(_) starts in insert mode. - In overwrite mode, characters bound to sseellff--iinnsseerrtt replace the text - at point rather than pushing the text to the right. Characters - bound to bbaacckkwwaarrdd--ddeelleettee--cchhaarr replace the character before point + In overwrite mode, characters bound to sseellff--iinnsseerrtt replace the text + at point rather than pushing the text to the right. Characters + bound to bbaacckkwwaarrdd--ddeelleettee--cchhaarr replace the character before point with a space. By default, this command is unbound, but may be bound to the Insert key on some keyboards. KKiilllliinngg aanndd YYaannkkiinngg kkiillll--lliinnee ((CC--kk)) - Kill the text from point to the end of the current line. With a - negative numeric argument, kill backward from the cursor to the be- + Kill the text from point to the end of the current line. With a + negative numeric argument, kill backward from the cursor to the be- ginning of the line. bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt)) Kill backward to the beginning of the current line. With a negative - numeric argument, kill forward from the cursor to the end of the + numeric argument, kill forward from the cursor to the end of the line. uunniixx--lliinnee--ddiissccaarrdd ((CC--uu)) - Kill backward from point to the beginning of the line, saving the + Kill backward from point to the beginning of the line, saving the killed text on the kill-ring. kkiillll--wwhhoollee--lliinnee Kill all characters on the current line, no matter where point is. kkiillll--wwoorrdd ((MM--dd)) Kill from point to the end of the current word, or if between words, - to the end of the next word. Word boundaries are the same as those + to the end of the next word. Word boundaries are the same as those used by ffoorrwwaarrdd--wwoorrdd. bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt)) - Kill the word behind point. Word boundaries are the same as those + Kill the word behind point. Word boundaries are the same as those used by bbaacckkwwaarrdd--wwoorrdd. sshheellll--kkiillll--wwoorrdd ((MM--CC--dd)) Kill from point to the end of the current word, or if between words, - to the end of the next word. Word boundaries are the same as those + to the end of the next word. Word boundaries are the same as those used by sshheellll--ffoorrwwaarrdd--wwoorrdd. sshheellll--bbaacckkwwaarrdd--kkiillll--wwoorrdd - Kill the word behind point. Word boundaries are the same as those + Kill the word behind point. Word boundaries are the same as those used by sshheellll--bbaacckkwwaarrdd--wwoorrdd. uunniixx--wwoorrdd--rruubboouutt ((CC--ww)) - Kill the word behind point, using white space as a word boundary, + Kill the word behind point, using white space as a word boundary, saving the killed text on the kill-ring. uunniixx--ffiilleennaammee--rruubboouutt - Kill the word behind point, using white space and the slash charac- + Kill the word behind point, using white space and the slash charac- ter as the word boundaries, saving the killed text on the kill-ring. ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\)) Delete all spaces and tabs around point. kkiillll--rreeggiioonn Kill the text in the current region. ccooppyy--rreeggiioonn--aass--kkiillll - Copy the text in the region to the kill buffer, so it can be yanked + Copy the text in the region to the kill buffer, so it can be yanked immediately. ccooppyy--bbaacckkwwaarrdd--wwoorrdd - Copy the word before point to the kill buffer. The word boundaries + Copy the word before point to the kill buffer. The word boundaries are the same as bbaacckkwwaarrdd--wwoorrdd. ccooppyy--ffoorrwwaarrdd--wwoorrdd - Copy the word following point to the kill buffer. The word bound- + Copy the word following point to the kill buffer. The word bound- aries are the same as ffoorrwwaarrdd--wwoorrdd. yyaannkk ((CC--yy)) Yank the top of the kill ring into the buffer at point. yyaannkk--ppoopp ((MM--yy)) - Rotate the kill ring, and yank the new top. Only works following + Rotate the kill ring, and yank the new top. Only works following yyaannkk or yyaannkk--ppoopp. NNuummeerriicc AArrgguummeennttss ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ...,, MM----)) - Add this digit to the argument already accumulating, or start a new + Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument. uunniivveerrssaall--aarrgguummeenntt This is another way to specify an argument. If this command is fol- - lowed by one or more digits, optionally with a leading minus sign, - those digits define the argument. If the command is followed by - digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the numeric argu- - ment, but is otherwise ignored. As a special case, if this command - is immediately followed by a character that is neither a digit nor + lowed by one or more digits, optionally with a leading minus sign, + those digits define the argument. If the command is followed by + digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the numeric argu- + ment, but is otherwise ignored. As a special case, if this command + is immediately followed by a character that is neither a digit nor minus sign, the argument count for the next command is multiplied by - four. The argument count is initially one, so executing this func- - tion the first time makes the argument count four, a second time + four. The argument count is initially one, so executing this func- + tion the first time makes the argument count four, a second time makes the argument count sixteen, and so on. CCoommpplleettiinngg ccoommpplleettee ((TTAABB)) - Attempt to perform completion on the text before point. BBaasshh at- + Attempt to perform completion on the text before point. BBaasshh at- tempts completion by first checking for any programmable completions - for the command word (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below), otherwise - treating the text as a variable (if the text begins with $$), user- - name (if the text begins with ~~), hostname (if the text begins with + for the command word (see PPrrooggrraammmmaabbllee CCoommpplleettiioonn below), otherwise + treating the text as a variable (if the text begins with $$), user- + name (if the text begins with ~~), hostname (if the text begins with @@), or command (including aliases, functions, and builtins) in turn. If none of these produces a match, it falls back to filename comple- tion. ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??)) - List the possible completions of the text before point. When dis- - playing completions, rreeaaddlliinnee sets the number of columns used for - display to the value of ccoommpplleettiioonn--ddiissppllaayy--wwiiddtthh, the value of the + List the possible completions of the text before point. When dis- + playing completions, rreeaaddlliinnee sets the number of columns used for + display to the value of ccoommpplleettiioonn--ddiissppllaayy--wwiiddtthh, the value of the shell variable CCOOLLUUMMNNSS, or the screen width, in that order. iinnsseerrtt--ccoommpplleettiioonnss ((MM--**)) Insert all completions of the text before point that would have been generated by ppoossssiibbllee--ccoommpplleettiioonnss, separated by a space. mmeennuu--ccoommpplleettee - Similar to ccoommpplleettee, but replaces the word to be completed with a + Similar to ccoommpplleettee, but replaces the word to be completed with a single match from the list of possible completions. Repeatedly exe- cuting mmeennuu--ccoommpplleettee steps through the list of possible completions, - inserting each match in turn. At the end of the list of comple- - tions, mmeennuu--ccoommpplleettee rings the bell (subject to the setting of - bbeellll--ssttyyllee) and restores the original text. An argument of _n moves - _n positions forward in the list of matches; a negative argument - moves backward through the list. This command is intended to be + inserting each match in turn. At the end of the list of comple- + tions, mmeennuu--ccoommpplleettee rings the bell (subject to the setting of + bbeellll--ssttyyllee) and restores the original text. An argument of _n moves + _n positions forward in the list of matches; a negative argument + moves backward through the list. This command is intended to be bound to TTAABB, but is unbound by default. mmeennuu--ccoommpplleettee--bbaacckkwwaarrdd - Identical to mmeennuu--ccoommpplleettee, but moves backward through the list of - possible completions, as if mmeennuu--ccoommpplleettee had been given a negative + Identical to mmeennuu--ccoommpplleettee, but moves backward through the list of + possible completions, as if mmeennuu--ccoommpplleettee had been given a negative argument. This command is unbound by default. eexxppoorrtt--ccoommpplleettiioonnss - Perform completion on the word before point as described above and - write the list of possible completions to rreeaaddlliinnee's output stream + Perform completion on the word before point as described above and + write the list of possible completions to rreeaaddlliinnee's output stream using the following format, writing information on separate lines: * the number of matches _N; * the word being completed; - * _S:_E, where _S and _E are the start and end offsets of the word + * _S:_E, where _S and _E are the start and end offsets of the word in the rreeaaddlliinnee line buffer; then * each match, one per line - If there are no matches, the first line will be "0", and this com- - mand does not print any output after the _S:_E. If there is only a - single match, this prints a single line containing it. If there is - more than one match, this prints the common prefix of the matches, - which may be empty, on the first line after the _S:_E, then the + If there are no matches, the first line will be "0", and this com- + mand does not print any output after the _S:_E. If there is only a + single match, this prints a single line containing it. If there is + more than one match, this prints the common prefix of the matches, + which may be empty, on the first line after the _S:_E, then the matches on subsequent lines. In this case, _N will include the first line with the common prefix. - The user or application should be able to accommodate the possibil- - ity of a blank line. The intent is that the user or application - reads _N lines after the line containing _S:_E to obtain the match + The user or application should be able to accommodate the possibil- + ity of a blank line. The intent is that the user or application + reads _N lines after the line containing _S:_E to obtain the match list. This command is unbound by default. ddeelleettee--cchhaarr--oorr--lliisstt - Deletes the character under the cursor if not at the beginning or - end of the line (like ddeelleettee--cchhaarr). At the end of the line, it be- - haves identically to ppoossssiibbllee--ccoommpplleettiioonnss. This command is unbound + Deletes the character under the cursor if not at the beginning or + end of the line (like ddeelleettee--cchhaarr). At the end of the line, it be- + haves identically to ppoossssiibbllee--ccoommpplleettiioonnss. This command is unbound by default. ccoommpplleettee--ffiilleennaammee ((MM--//)) Attempt filename completion on the text before point. ppoossssiibbllee--ffiilleennaammee--ccoommpplleettiioonnss ((CC--xx //)) - List the possible completions of the text before point, treating it + List the possible completions of the text before point, treating it as a filename. ccoommpplleettee--uusseerrnnaammee ((MM--~~)) - Attempt completion on the text before point, treating it as a user- + Attempt completion on the text before point, treating it as a user- name. ppoossssiibbllee--uusseerrnnaammee--ccoommpplleettiioonnss ((CC--xx ~~)) - List the possible completions of the text before point, treating it + List the possible completions of the text before point, treating it as a username. ccoommpplleettee--vvaarriiaabbllee ((MM--$$)) - Attempt completion on the text before point, treating it as a shell + Attempt completion on the text before point, treating it as a shell variable. ppoossssiibbllee--vvaarriiaabbllee--ccoommpplleettiioonnss ((CC--xx $$)) - List the possible completions of the text before point, treating it + List the possible completions of the text before point, treating it as a shell variable. ccoommpplleettee--hhoossttnnaammee ((MM--@@)) - Attempt completion on the text before point, treating it as a host- + Attempt completion on the text before point, treating it as a host- name. ppoossssiibbllee--hhoossttnnaammee--ccoommpplleettiioonnss ((CC--xx @@)) - List the possible completions of the text before point, treating it + List the possible completions of the text before point, treating it as a hostname. ccoommpplleettee--ccoommmmaanndd ((MM--!!)) - Attempt completion on the text before point, treating it as a com- - mand name. Command completion attempts to match the text against - aliases, reserved words, shell functions, shell builtins, and fi- + Attempt completion on the text before point, treating it as a com- + mand name. Command completion attempts to match the text against + aliases, reserved words, shell functions, shell builtins, and fi- nally executable filenames, in that order. ppoossssiibbllee--ccoommmmaanndd--ccoommpplleettiioonnss ((CC--xx !!)) - List the possible completions of the text before point, treating it + List the possible completions of the text before point, treating it as a command name. ddyynnaammiicc--ccoommpplleettee--hhiissttoorryy ((MM--TTAABB)) - Attempt completion on the text before point, comparing the text + Attempt completion on the text before point, comparing the text against history list entries for possible completion matches. ddaabbbbrreevv--eexxppaanndd @@ -4495,8 +4495,8 @@ RREEAADDLLIINNEE against lines from the history list for possible completion matches. ccoommpplleettee--iinnttoo--bbrraacceess ((MM--{{)) - Perform filename completion and insert the list of possible comple- - tions enclosed within braces so the list is available to the shell + Perform filename completion and insert the list of possible comple- + tions enclosed within braces so the list is available to the shell (see BBrraaccee EExxppaannssiioonn above). KKeeyybbooaarrdd MMaaccrrooss @@ -4509,18 +4509,18 @@ RREEAADDLLIINNEE Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard. pprriinntt--llaasstt--kkbbdd--mmaaccrroo (()) - Print the last keyboard macro defined in a format suitable for the + Print the last keyboard macro defined in a format suitable for the _i_n_p_u_t_r_c file. MMiisscceellllaanneeoouuss rree--rreeaadd--iinniitt--ffiillee ((CC--xx CC--rr)) - Read in the contents of the _i_n_p_u_t_r_c file, and incorporate any bind- + Read in the contents of the _i_n_p_u_t_r_c file, and incorporate any bind- ings or variable assignments found there. aabboorrtt ((CC--gg)) Abort the current editing command and ring the terminal's bell (sub- ject to the setting of bbeellll--ssttyyllee). ddoo--lloowweerrccaassee--vveerrssiioonn ((MM--AA,, MM--BB,, MM--_x,, ...)) - If the metafied character _x is uppercase, run the command that is + If the metafied character _x is uppercase, run the command that is bound to the corresponding metafied lowercase character. The behav- ior is undefined if _x is already lowercase. pprreeffiixx--mmeettaa ((EESSCC)) @@ -4533,71 +4533,71 @@ RREEAADDLLIINNEE ttiillddee--eexxppaanndd ((MM--&&)) Perform tilde expansion on the current word. sseett--mmaarrkk ((CC--@@,, MM--<>)) - Set the mark to the point. If a numeric argument is supplied, set + Set the mark to the point. If a numeric argument is supplied, set the mark to that position. eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx)) - Swap the point with the mark. Set the current cursor position to + Swap the point with the mark. Set the current cursor position to the saved position, then set the mark to the old cursor position. cchhaarraacctteerr--sseeaarrcchh ((CC--]])) Read a character and move point to the next occurrence of that char- acter. A negative argument searches for previous occurrences. cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]])) - Read a character and move point to the previous occurrence of that + Read a character and move point to the previous occurrence of that character. A negative argument searches for subsequent occurrences. sskkiipp--ccssii--sseeqquueennccee Read enough characters to consume a multi-key sequence such as those defined for keys like Home and End. CSI sequences begin with a Con- - trol Sequence Indicator (CSI), usually _E_S_C _[. If this sequence is - bound to "\e[", keys producing CSI sequences have no effect unless - explicitly bound to a rreeaaddlliinnee command, instead of inserting stray + trol Sequence Indicator (CSI), usually _E_S_C _[. If this sequence is + bound to "\e[", keys producing CSI sequences have no effect unless + explicitly bound to a rreeaaddlliinnee command, instead of inserting stray characters into the editing buffer. This is unbound by default, but usually bound to _E_S_C _[. iinnsseerrtt--ccoommmmeenntt ((MM--##)) - Without a numeric argument, insert the value of the rreeaaddlliinnee ccoomm-- - mmeenntt--bbeeggiinn variable at the beginning of the current line. If a nu- - meric argument is supplied, this command acts as a toggle: if the - characters at the beginning of the line do not match the value of - ccoommmmeenntt--bbeeggiinn, insert the value; otherwise delete the characters in - ccoommmmeenntt--bbeeggiinn from the beginning of the line. In either case, the - line is accepted as if a newline had been typed. The default value - of ccoommmmeenntt--bbeeggiinn causes this command to make the current line a - shell comment. If a numeric argument causes the comment character + Without a numeric argument, insert the value of the rreeaaddlliinnee ccoomm-- + mmeenntt--bbeeggiinn variable at the beginning of the current line. If a nu- + meric argument is supplied, this command acts as a toggle: if the + characters at the beginning of the line do not match the value of + ccoommmmeenntt--bbeeggiinn, insert the value; otherwise delete the characters in + ccoommmmeenntt--bbeeggiinn from the beginning of the line. In either case, the + line is accepted as if a newline had been typed. The default value + of ccoommmmeenntt--bbeeggiinn causes this command to make the current line a + shell comment. If a numeric argument causes the comment character to be removed, the line will be executed by the shell. ssppeellll--ccoorrrreecctt--wwoorrdd ((CC--xx ss)) - Perform spelling correction on the current word, treating it as a - directory or filename, in the same way as the ccddssppeellll shell option. + Perform spelling correction on the current word, treating it as a + directory or filename, in the same way as the ccddssppeellll shell option. Word boundaries are the same as those used by sshheellll--ffoorrwwaarrdd--wwoorrdd. gglloobb--ccoommpplleettee--wwoorrdd ((MM--gg)) - Treat the word before point as a pattern for pathname expansion, + Treat the word before point as a pattern for pathname expansion, with an asterisk implicitly appended, then use the pattern to gener- ate a list of matching file names for possible completions. gglloobb--eexxppaanndd--wwoorrdd ((CC--xx **)) Treat the word before point as a pattern for pathname expansion, and - insert the list of matching file names, replacing the word. If a + insert the list of matching file names, replacing the word. If a numeric argument is supplied, append a ** before pathname expansion. gglloobb--lliisstt--eexxppaannssiioonnss ((CC--xx gg)) - Display the list of expansions that would have been generated by - gglloobb--eexxppaanndd--wwoorrdd and redisplay the line. If a numeric argument is + Display the list of expansions that would have been generated by + gglloobb--eexxppaanndd--wwoorrdd and redisplay the line. If a numeric argument is supplied, append a ** before pathname expansion. dduummpp--ffuunnccttiioonnss - Print all of the functions and their key bindings to the rreeaaddlliinnee - output stream. If a numeric argument is supplied, the output is + Print all of the functions and their key bindings to the rreeaaddlliinnee + output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. dduummpp--vvaarriiaabblleess Print all of the settable rreeaaddlliinnee variables and their values to the rreeaaddlliinnee output stream. If a numeric argument is supplied, the out- - put is formatted in such a way that it can be made part of an _i_n_p_u_- + put is formatted in such a way that it can be made part of an _i_n_p_u_- _t_r_c file. dduummpp--mmaaccrrooss - Print all of the rreeaaddlliinnee key sequences bound to macros and the + Print all of the rreeaaddlliinnee key sequences bound to macros and the strings they output to the rreeaaddlliinnee output stream. If a numeric ar- - gument is supplied, the output is formatted in such a way that it + gument is supplied, the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. eexxeeccuuttee--nnaammeedd--ccoommmmaanndd ((MM--xx)) Read a bindable rreeaaddlliinnee command name from the input and execute the function to which it's bound, as if the key sequence to which it was - bound appeared in the input. If this function is supplied with a - numeric argument, it passes that argument to the function it exe- + bound appeared in the input. If this function is supplied with a + numeric argument, it passes that argument to the function it exe- cutes. ddiissppllaayy--sshheellll--vveerrssiioonn ((CC--xx CC--vv)) Display version information about the current instance of bbaasshh. @@ -4605,148 +4605,148 @@ RREEAADDLLIINNEE PPrrooggrraammmmaabbllee CCoommpplleettiioonn When a user attempts word completion for a command or an argument to a com- mand for which a completion specification (a _c_o_m_p_s_p_e_c) has been defined us- - ing the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), rreeaaddlliinnee in- + ing the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), rreeaaddlliinnee in- vokes the programmable completion facilities. - First, bbaasshh identifies the command name. If a compspec has been defined - for that command, the compspec is used to generate the list of possible + First, bbaasshh identifies the command name. If a compspec has been defined + for that command, the compspec is used to generate the list of possible completions for the word. If the command word is the empty string (comple- - tion attempted at the beginning of an empty line), bbaasshh uses any compspec - defined with the --EE option to ccoommpplleettee. The --II option to ccoommpplleettee indi- - cates that the command word is the first non-assignment word on the line, - or after a command delimiter such as ;; or ||. This usually indicates com- + tion attempted at the beginning of an empty line), bbaasshh uses any compspec + defined with the --EE option to ccoommpplleettee. The --II option to ccoommpplleettee indi- + cates that the command word is the first non-assignment word on the line, + or after a command delimiter such as ;; or ||. This usually indicates com- mand name completion. - If the command word is a full pathname, bbaasshh searches for a compspec for - the full pathname first. If there is no compspec for the full pathname, + If the command word is a full pathname, bbaasshh searches for a compspec for + the full pathname first. If there is no compspec for the full pathname, bbaasshh attempts to find a compspec for the portion following the final slash. - If those searches do not result in a compspec, or if there is no compspec - for the command word, bbaasshh uses any compspec defined with the --DD option to - ccoommpplleettee as the default. If there is no default compspec, bbaasshh performs + If those searches do not result in a compspec, or if there is no compspec + for the command word, bbaasshh uses any compspec defined with the --DD option to + ccoommpplleettee as the default. If there is no default compspec, bbaasshh performs alias expansion on the command word as a final resort, and attempts to find a compspec for the command word resulting from any successful expansion. - If a compspec is not found, bbaasshh performs its default completion as de- + If a compspec is not found, bbaasshh performs its default completion as de- scribed above under CCoommpplleettiinngg. Otherwise, once a compspec has been found, bbaasshh uses it to generate the list of matching words. - First, bbaasshh performs the _a_c_t_i_o_n_s specified by the compspec. This only re- - turns matches which are prefixes of the word being completed. When the --ff - or --dd option is used for filename or directory name completion, bbaasshh uses + First, bbaasshh performs the _a_c_t_i_o_n_s specified by the compspec. This only re- + turns matches which are prefixes of the word being completed. When the --ff + or --dd option is used for filename or directory name completion, bbaasshh uses the shell variable FFIIGGNNOORREE to filter the matches. Next, programmable completion generates matches specified by a pathname ex- pansion pattern supplied as an argument to the --GG option. The words gener- ated by the pattern need not match the word being completed. BBaasshh uses the - FFIIGGNNOORREE variable to filter the matches, but does not use the GGLLOOBBIIGGNNOORREE + FFIIGGNNOORREE variable to filter the matches, but does not use the GGLLOOBBIIGGNNOORREE shell variable. - Next, completion considers the string specified as the argument to the --WW - option. The string is first split using the characters in the IIFFSS special - variable as delimiters. This honors shell quoting within the string, in - order to provide a mechanism for the words to contain shell metacharacters - or characters in the value of IIFFSS. Each word is then expanded using brace - expansion, tilde expansion, parameter and variable expansion, command sub- - stitution, and arithmetic expansion, as described above under EEXXPPAANNSSIIOONN. + Next, completion considers the string specified as the argument to the --WW + option. The string is first split using the characters in the IIFFSS special + variable as delimiters. This honors shell quoting within the string, in + order to provide a mechanism for the words to contain shell metacharacters + or characters in the value of IIFFSS. Each word is then expanded using brace + expansion, tilde expansion, parameter and variable expansion, command sub- + stitution, and arithmetic expansion, as described above under EEXXPPAANNSSIIOONN. The results are split using the rules described above under WWoorrdd SSpplliittttiinngg. The results of the expansion are prefix-matched against the word being com- pleted, and the matching words become possible completions. - After these matches have been generated, bbaasshh executes any shell function + After these matches have been generated, bbaasshh executes any shell function or command specified with the --FF and --CC options. When the command or func- tion is invoked, bbaasshh assigns values to the CCOOMMPP__LLIINNEE, CCOOMMPP__PPOOIINNTT, CCOOMMPP__KKEEYY, and CCOOMMPP__TTYYPPEE variables as described above under SShheellll VVaarriiaabblleess. - If a shell function is being invoked, bbaasshh also sets the CCOOMMPP__WWOORRDDSS and - CCOOMMPP__CCWWOORRDD variables. When the function or command is invoked, the first - argument ($$11) is the name of the command whose arguments are being com- + If a shell function is being invoked, bbaasshh also sets the CCOOMMPP__WWOORRDDSS and + CCOOMMPP__CCWWOORRDD variables. When the function or command is invoked, the first + argument ($$11) is the name of the command whose arguments are being com- pleted, the second argument ($$22) is the word being completed, and the third argument ($$33) is the word preceding the word being completed on the current - command line. There is no filtering of the generated completions against - the word being completed; the function or command has complete freedom in + command line. There is no filtering of the generated completions against + the word being completed; the function or command has complete freedom in generating the matches and they do not need to match a prefix of the word. - Any function specified with --FF is invoked first. The function may use any - of the shell facilities, including the ccoommppggeenn and ccoommppoopptt builtins de- - scribed below, to generate the matches. It must put the possible comple- + Any function specified with --FF is invoked first. The function may use any + of the shell facilities, including the ccoommppggeenn and ccoommppoopptt builtins de- + scribed below, to generate the matches. It must put the possible comple- tions in the CCOOMMPPRREEPPLLYY array variable, one per array element. Next, any command specified with the --CC option is invoked in an environment equivalent to command substitution. It should print a list of completions, - one per line, to the standard output. Backslash will escape a newline, if + one per line, to the standard output. Backslash will escape a newline, if necessary. These are added to the set of possible completions. External commands that are invoked to generate completions ( "external com- pleters") receive the word preceding the completion word as an argument, as - described above. This provides context that is sometimes useful, but may - include information that is considered sensitive or part of a word expan- - sion that will not appear in the command line after expansion. That word + described above. This provides context that is sometimes useful, but may + include information that is considered sensitive or part of a word expan- + sion that will not appear in the command line after expansion. That word may be visible in process listings or in audit logs. This may be a concern - to users and completion specification authors if there is sensitive infor- - mation on the command line before expansion, since completion takes place - before words are expanded. If this is an issue, completion authors should - use functions as wrappers around external commands and pass context infor- + to users and completion specification authors if there is sensitive infor- + mation on the command line before expansion, since completion takes place + before words are expanded. If this is an issue, completion authors should + use functions as wrappers around external commands and pass context infor- mation to the external command in a different way. External completers can - infer context from the CCOOMMPP__LLIINNEE and CCOOMMPP__PPOOIINNTT environment variables, but - they need to ensure they break words in the same way rreeaaddlliinnee does, using + infer context from the CCOOMMPP__LLIINNEE and CCOOMMPP__PPOOIINNTT environment variables, but + they need to ensure they break words in the same way rreeaaddlliinnee does, using the CCOOMMPP__WWOORRDDBBRREEAAKKSS variable. - After generating all of the possible completions, bbaasshh applies any filter + After generating all of the possible completions, bbaasshh applies any filter specified with the --XX option to the completions in the list. The filter is - a pattern as used for pathname expansion; a && in the pattern is replaced + a pattern as used for pathname expansion; a && in the pattern is replaced with the text of the word being completed. A literal && may be escaped with - a backslash; the backslash is removed before attempting a match. Any com- - pletion that matches the pattern is removed from the list. A leading !! + a backslash; the backslash is removed before attempting a match. Any com- + pletion that matches the pattern is removed from the list. A leading !! negates the pattern; in this case bbaasshh removes any completion that does not - match the pattern. If the nnooccaasseemmaattcchh shell option is enabled, bbaasshh per- + match the pattern. If the nnooccaasseemmaattcchh shell option is enabled, bbaasshh per- forms the match without regard to the case of alphabetic characters. - Finally, programmable completion adds any prefix and suffix specified with - the --PP and --SS options, respectively, to each completion, and returns the + Finally, programmable completion adds any prefix and suffix specified with + the --PP and --SS options, respectively, to each completion, and returns the result to rreeaaddlliinnee as the list of possible completions. - If the previously-applied actions do not generate any matches, and the --oo - ddiirrnnaammeess option was supplied to ccoommpplleettee when the compspec was defined, + If the previously-applied actions do not generate any matches, and the --oo + ddiirrnnaammeess option was supplied to ccoommpplleettee when the compspec was defined, bbaasshh attempts directory name completion. - If the --oo pplluussddiirrss option was supplied to ccoommpplleettee when the compspec was - defined, bbaasshh attempts directory name completion and adds any matches to + If the --oo pplluussddiirrss option was supplied to ccoommpplleettee when the compspec was + defined, bbaasshh attempts directory name completion and adds any matches to the set of possible completions. - By default, if a compspec is found, whatever it generates is returned to - the completion code as the full set of possible completions. The default - bbaasshh completions and the rreeaaddlliinnee default of filename completion are dis- - abled. If the --oo bbaasshhddeeffaauulltt option was supplied to ccoommpplleettee when the - compspec was defined, and the compspec generates no matches, bbaasshh attempts - its default completions. If the compspec and, if attempted, the default - bbaasshh completions generate no matches, and the --oo ddeeffaauulltt option was sup- - plied to ccoommpplleettee when the compspec was defined, programmable completion + By default, if a compspec is found, whatever it generates is returned to + the completion code as the full set of possible completions. The default + bbaasshh completions and the rreeaaddlliinnee default of filename completion are dis- + abled. If the --oo bbaasshhddeeffaauulltt option was supplied to ccoommpplleettee when the + compspec was defined, and the compspec generates no matches, bbaasshh attempts + its default completions. If the compspec and, if attempted, the default + bbaasshh completions generate no matches, and the --oo ddeeffaauulltt option was sup- + plied to ccoommpplleettee when the compspec was defined, programmable completion performs rreeaaddlliinnee's default completion. - The options supplied to ccoommpplleettee and ccoommppoopptt can control how rreeaaddlliinnee - treats the completions. For instance, the --oo ffuullllqquuoottee option tells rreeaadd-- - lliinnee to quote the matches as if they were filenames. See the description + The options supplied to ccoommpplleettee and ccoommppoopptt can control how rreeaaddlliinnee + treats the completions. For instance, the --oo ffuullllqquuoottee option tells rreeaadd-- + lliinnee to quote the matches as if they were filenames. See the description of ccoommpplleettee below for details. When a compspec indicates that it wants directory name completion, the pro- - grammable completion functions force rreeaaddlliinnee to append a slash to com- - pleted names which are symbolic links to directories, subject to the value + grammable completion functions force rreeaaddlliinnee to append a slash to com- + pleted names which are symbolic links to directories, subject to the value of the mmaarrkk--ddiirreeccttoorriieess rreeaaddlliinnee variable, regardless of the setting of the mmaarrkk--ssyymmlliinnkkeedd--ddiirreeccttoorriieess rreeaaddlliinnee variable. - There is some support for dynamically modifying completions. This is most - useful when used in combination with a default completion specified with - ccoommpplleettee --DD. It's possible for shell functions executed as completion - functions to indicate that completion should be retried by returning an + There is some support for dynamically modifying completions. This is most + useful when used in combination with a default completion specified with + ccoommpplleettee --DD. It's possible for shell functions executed as completion + functions to indicate that completion should be retried by returning an exit status of 124. If a shell function returns 124, and changes the comp- - spec associated with the command on which completion is being attempted - (supplied as the first argument when the function is executed), programma- - ble completion restarts from the beginning, with an attempt to find a new - compspec for that command. This can be used to build a set of completions - dynamically as completion is attempted, rather than loading them all at + spec associated with the command on which completion is being attempted + (supplied as the first argument when the function is executed), programma- + ble completion restarts from the beginning, with an attempt to find a new + compspec for that command. This can be used to build a set of completions + dynamically as completion is attempted, rather than loading them all at once. For instance, assuming that there is a library of compspecs, each kept in a - file corresponding to the name of the command, the following default com- + file corresponding to the name of the command, the following default com- pletion function would load completions dynamically: _completion_loader() { @@ -4755,37 +4755,51 @@ RREEAADDLLIINNEE complete -D -F _completion_loader -o bashdefault -o default HHIISSTTOORRYY - When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell pro- + When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell pro- vides access to the _c_o_m_m_a_n_d _h_i_s_t_o_r_y, the list of commands previously typed. - The value of the HHIISSTTSSIIZZEE variable is used as the number of commands to - save in a history list: the shell saves the text of the last HHIISSTTSSIIZZEE com- - mands (default 500). The shell stores each command in the history list - prior to parameter and variable expansion (see EEXXPPAANNSSIIOONN above) but after - history expansion is performed, subject to the values of the shell vari- + The value of the HHIISSTTSSIIZZEE variable is used as the number of commands to + save in a history list: the shell saves the text of the last HHIISSTTSSIIZZEE com- + mands (default 500). The shell stores each command in the history list + prior to parameter and variable expansion (see EEXXPPAANNSSIIOONN above) but after + history expansion is performed, subject to the values of the shell vari- ables HHIISSTTIIGGNNOORREE and HHIISSTTCCOONNTTRROOLL. - On startup, bbaasshh initializes the history list by reading history entries - from the file named by the HHIISSTTFFIILLEE variable (default _~_/_._b_a_s_h___h_i_s_t_o_r_y). - That file is referred to as the _h_i_s_t_o_r_y _f_i_l_e. The history file is trun- - cated, if necessary, to contain no more than the number of history entries - specified by the value of the HHIISSTTFFIILLEESSIIZZEE variable. If HHIISSTTFFIILLEESSIIZZEE is - unset, or set to null, a non-numeric value, or a numeric value less than - zero, the history file is not truncated. + On startup, bbaasshh initializes the history list by reading history entries + from the file named by the HHIISSTTFFIILLEE variable (default _~_/_._b_a_s_h___h_i_s_t_o_r_y). + That file is referred to as the _h_i_s_t_o_r_y _f_i_l_e. The history file is trun- + cated, if necessary, to contain no more than the number of lines or history + entries specified by the value of the HHIISSTTFFIILLEESSIIZZEE variable. - When the history file is read, lines beginning with the history comment + The value of HHIISSTTFFIILLEESSIIZZEE is interpreted as lines or possibly multi-line + history entries depending on whether the HHIISSTTTTIIMMEEFFOORRMMAATT variable has a + value, since that controls whether or not timestamps are written to the + history file. If HHIISSTTTTIIMMEEFFOORRMMAATT has a value, HHIISSTTFFIILLEESSIIZZEE is interpreted + as a number of history entries, including timestamps. If it does not, + HHIISSTTFFIILLEESSIIZZEE is interpreted as a number of lines, which may result in in- + complete history entries in the history file, or the history file contain- + ing more lines than this maximum to avoid leaving partial history entries. + + If HHIISSTTFFIILLEESSIIZZEE is unset, or set to null, a non-numeric value, or a numeric + value less than zero, the history file is not truncated. + + When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as timestamps for - the following history line. These timestamps are optionally displayed de- + the following history line. These timestamps are optionally displayed de- pending on the value of the HHIISSTTTTIIMMEEFFOORRMMAATT variable. When present, history timestamps delimit history entries, making multi-line entries possible. - When a shell with history enabled exits, bbaasshh copies the last $$HHIISSTTSSIIZZEE en- - tries from the history list to $$HHIISSTTFFIILLEE. If the hhiissttaappppeenndd shell option - is enabled (see the description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS be- - low), bbaasshh appends the entries to the history file, otherwise it overwrites - the history file. If HHIISSTTFFIILLEE is unset or null, or if the history file is - unwritable, the history is not saved. After saving the history, bbaasshh trun- - cates the history file to contain no more than HHIISSTTFFIILLEESSIIZZEE lines as de- - scribed above. + When a shell with history enabled exits, bbaasshh copies up to the last $$HHIISSTT-- + SSIIZZEE entries from the history list to the file named by $$HHIISSTTFFIILLEE. If the + hhiissttaappppeenndd shell option is enabled (see the description of sshhoopptt under + SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), or if the number of history entries entered + during the current shell session is not greater than $$HHIISSTTSSIIZZEE, bbaasshh ap- + pends the entries entered during the current session to $$HHIISSTTFFIILLEE. If + hhiissttaappppeenndd is not set, and the number of entries from the current shell + session exceeds $$HHIISSTTSSIIZZEE, it overwrites the history file with the entries + from the current session. If HHIISSTTFFIILLEE is unset or null, or if the history + file is unwritable, the history is not saved. After saving the history, + bbaasshh truncates the history file to contain no more than HHIISSTTFFIILLEESSIIZZEE en- + tries as described above. If the HHIISSTTTTIIMMEEFFOORRMMAATT variable is set, the shell writes the timestamp in- formation associated with each history entry to the history file, marked @@ -6674,7 +6688,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS hhiissttaappppeenndd If set, the history list is appended to the file named by the value of the HHIISSTTFFIILLEE variable when the shell exits, - rather than overwriting the file. + rather than potentially overwriting the file. hhiissttrreeeeddiitt If set, and rreeaaddlliinnee is being used, the user is given the opportunity to re-edit a failed history substitution. @@ -7400,4 +7414,4 @@ BBUUGGSS Array variables may not (yet) be exported. -GNU Bash 5.4 2026 August 20 _B_A_S_H(1) +GNU Bash 5.4 2026 August 27 _B_A_S_H(1) diff --git a/doc/bash.1 b/doc/bash.1 index 379b4007..225ede3d 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,7 +5,7 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Thu Aug 20 11:41:54 EDT 2026 +.\" Last Change: Thu Aug 27 12:59:58 EDT 2026 .\" .\" For bash_builtins, strip all but "SHELL BUILTIN COMMANDS" section .\" For rbash, strip all but "RESTRICTED SHELL" section @@ -22,7 +22,7 @@ .ds zX \" empty .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2026 August 20" "GNU Bash 5.4" +.TH BASH 1 "2026 August 27" "GNU Bash 5.4" .\" .ie \n(.g \{\ .ds ' \(aq @@ -2707,19 +2707,23 @@ is unset or null, the shell does not save the command history when it exits. .TP .B HISTFILESIZE -The maximum number of lines contained in the history file. +The maximum number of lines or history entries contained in the history file. When this variable is assigned a value, the history file is truncated, if necessary, to contain no more than -the number of history entries -that total no more than that number of lines -by removing the oldest entries. -If the history list contains multi-line entries, -the history file may contain more lines than this maximum -to avoid leaving partial history entries. +the number of history entries or lines, +depending on whether +.B HISTTIMEFORMAT +is set, by removing the oldest entries. +See +.SM +.B HISTORY +below +for a description of how +.B HISTTIMEFORMAT +affects how the value is treated and +whether it refers to lines or history entries. The history file is also truncated to this size after -writing it when a shell exits or by the -.B \%history -builtin. +writing it when a shell exits. If the value is 0, the history file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation. The shell sets the default value to the value of @@ -8723,11 +8727,34 @@ variable (default .FN \*~/.bash_history ). That file is referred to as the \fIhistory file\fP. The history file is truncated, if necessary, -to contain no more than the number of history entries +to contain no more than the number of lines or +history entries specified by the value of the .SM .B HISTFILESIZE variable. +.PP +The value of +.B HISTFILESIZE +is interpreted as lines or possibly multi-line history +entries depending on whether the +.B HISTTIMEFORMAT +variable has a value, +since that controls whether or not timestamps are written +to the history file. +If +.B HISTTIMEFORMAT +has a value, +.B HISTFILESIZE +is interpreted as a number of +history entries, including timestamps. +If it does not, +.B HISTFILESIZE +is interpreted as a number of lines, +which may result in incomplete history entries in the history file, +or the history file containing more lines than this maximum +to avoid leaving partial history entries. +.PP If .SM .B HISTFILESIZE @@ -8744,10 +8771,12 @@ variable. When present, history timestamps delimit history entries, making multi-line entries possible. .PP -When a shell with history enabled exits, \fBbash\fP copies the last +When a shell with history enabled exits, \fBbash\fP +copies up to the last .SM .B $HISTSIZE entries from the history list to +the file named by .SM .BR $HISTFILE . If the @@ -8758,8 +8787,18 @@ shell option is enabled under .SM .B "SHELL BUILTIN COMMANDS" -below), \fBbash\fP appends the entries to the history file, -otherwise it overwrites the history file. +below), +or if the number of history entries entered +during the current shell session is not greater than +.BR $HISTSIZE , +\fBbash\fP appends the entries entered during the current session to +.BR $HISTFILE . +If +.B histappend +is not set, and the number of entries from the current +shell session exceeds +.BR $HISTSIZE , +it overwrites the history file with the entries from the current session. If .SM .B HISTFILE @@ -8769,7 +8808,7 @@ After saving the history, \fBbash\fP truncates the history file to contain no more than .SM .B HISTFILESIZE -lines as described above. +entries as described above. .PP If the .SM @@ -12404,7 +12443,8 @@ If set, the history list is appended to the file named by the value of the .SM .B HISTFILE -variable when the shell exits, rather than overwriting the file. +variable when the shell exits, rather than +potentially overwriting the file. .TP 8 .B histreedit If set, and diff --git a/doc/bash.info b/doc/bash.info index abb3b3fe..7397ab4e 100644 --- a/doc/bash.info +++ b/doc/bash.info @@ -1,9 +1,9 @@ This is bash.info, produced by makeinfo version 7.3 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.4, 20 August 2026). +Bash shell (version 5.4, 27 August 2026). - This is Edition 5.4, last updated 20 August 2026, of ‘The GNU Bash + This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.4. Copyright © 1988-2026 Free Software Foundation, Inc. @@ -26,10 +26,10 @@ Bash Features ************* This text is a brief description of the features that are present in the -Bash shell (version 5.4, 20 August 2026). The Bash home page is +Bash shell (version 5.4, 27 August 2026). The Bash home page is . - This is Edition 5.4, last updated 20 August 2026, of ‘The GNU Bash + This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.4. Bash contains features that appear in other popular shells, and some @@ -5430,7 +5430,7 @@ This builtin allows you to change additional optional shell behavior. ‘histappend’ If set, the history list is appended to the file named by the value of the ‘HISTFILE’ variable when the shell exits, rather - than overwriting the file. + than potentially overwriting the file. ‘histreedit’ If set, and Readline is being used, the user is given the @@ -6161,15 +6161,18 @@ Variables::). exits. ‘HISTFILESIZE’ - The maximum number of lines contained in the history file. When - this variable is assigned a value, the history file is truncated, - if necessary, to contain no more than the number of history entries - that total no more than that number of lines by removing the oldest - entries. If the history list contains multi-line entries, the - history file may contain more lines than this maximum to avoid - leaving partial history entries. The history file is also - truncated to this size after writing it when a shell exits or by - the ‘history’ builtin. If the value is 0, the history file is + The maximum number of lines or history entries contained in the + history file. When this variable is assigned a value, the history + file is truncated, if necessary, to contain no more than that + number of history entries or lines, depending on the value of + ‘HISTTIMEFORMAT’, by removing the oldest entries. + + *Note Bash History Facilities::, for a description of how + ‘HISTTIMEFORMAT’ affects how the value is treated and whether it + refers to lines or history entries. + + The history file is also truncated to this size after writing it + when a shell exits. If the value is 0, the history file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation. The shell sets the default value to the value of ‘HISTSIZE’ after reading any startup files. @@ -11012,10 +11015,21 @@ the values of the shell variables ‘HISTIGNORE’ and ‘HISTCONTROL’. reading history entries from the file named by the ‘HISTFILE’ variable (default ‘~/.bash_history’). This is referred to as the “history file”. The history file is truncated, if necessary, to contain no more than the -number of history entries specified by the value of the ‘HISTFILESIZE’ -variable. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric -value, or a numeric value less than zero, the history file is not -truncated. +number of lines or history entries specified by the value of the +‘HISTFILESIZE’ variable. + + The value of ‘HISTFILESIZE’ is interpreted as lines or possibly +multi-line history entries depending on whether the ‘HISTTIMEFORMAT’ +variable has a value, since that controls whether or not timestamps are +written to the history file. If ‘HISTTIMEFORMAT’ has a value, +‘HISTFILESIZE’ is interpreted as a number of history entries, including +timestamps. If it does not, ‘HISTFILESIZE’ is interpreted as a number +of lines, which may result in incomplete history entries in the history +file, or the history file containing more lines than this maximum to +avoid leaving partial history entries. + + If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric value, or a +numeric value less than zero, the history file is not truncated. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as @@ -11024,14 +11038,18 @@ optionally displayed depending on the value of the ‘HISTTIMEFORMAT’ variable (*note Bash Variables::). When present, history timestamps delimit history entries, making multi-line entries possible. - When a shell with history enabled exits, Bash copies the last + When a shell with history enabled exits, Bash copies up to the last ‘$HISTSIZE’ entries from the history list to the file named by ‘$HISTFILE’. If the ‘histappend’ shell option is set (*note Bash -Builtins::), Bash appends the entries to the history file, otherwise it -overwrites the history file. If ‘HISTFILE’ is unset or null, or if the -history file is unwritable, the history is not saved. After saving the -history, Bash truncates the history file to contain no more than -‘$HISTFILESIZE’ lines as described above. +Builtins::), or if the number of history entries entered during the +current shell session is less than ‘$HISTSIZE’, Bash appends the history +entries entered during the current session to ‘$HISTFILE’. If +‘histappend’ is not set, and the number of entries from the current +shell session exceeds ‘$HISTSIZE’, it overwrites the history file with +the entries from the current session. If ‘HISTFILE’ is unset or null, +or if the history file is unwritable, the history is not saved. After +saving the history, Bash truncates the history file to contain no more +than ‘$HISTFILESIZE’ entries as described above. If the ‘HISTTIMEFORMAT’ variable is set, the shell writes the timestamp information associated with each history entry to the history @@ -13294,51 +13312,51 @@ D.3 Parameter and Variable Index * HISTCONTROL: Bash Variables. (line 445) * HISTFILE: Bash Variables. (line 463) * HISTFILESIZE: Bash Variables. (line 469) -* HISTIGNORE: Bash Variables. (line 483) +* HISTIGNORE: Bash Variables. (line 486) * history-preserve-point: Readline Init File Syntax. (line 236) * history-size: Readline Init File Syntax. (line 242) -* HISTSIZE: Bash Variables. (line 507) -* HISTTIMEFORMAT: Bash Variables. (line 514) +* HISTSIZE: Bash Variables. (line 510) +* HISTTIMEFORMAT: Bash Variables. (line 517) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. (line 252) -* HOSTFILE: Bash Variables. (line 523) -* HOSTNAME: Bash Variables. (line 534) -* HOSTTYPE: Bash Variables. (line 537) +* HOSTFILE: Bash Variables. (line 526) +* HOSTNAME: Bash Variables. (line 537) +* HOSTTYPE: Bash Variables. (line 540) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 540) +* IGNOREEOF: Bash Variables. (line 543) * input-meta: Readline Init File Syntax. (line 260) -* INPUTRC: Bash Variables. (line 549) -* INSIDE_EMACS: Bash Variables. (line 553) +* INPUTRC: Bash Variables. (line 552) +* INSIDE_EMACS: Bash Variables. (line 556) * isearch-terminators: Readline Init File Syntax. (line 271) * keymap: Readline Init File Syntax. (line 278) * LANG: Creating Internationalized Scripts. (line 51) -* LANG <1>: Bash Variables. (line 559) -* LC_ALL: Bash Variables. (line 563) -* LC_COLLATE: Bash Variables. (line 567) -* LC_CTYPE: Bash Variables. (line 574) +* LANG <1>: Bash Variables. (line 562) +* LC_ALL: Bash Variables. (line 566) +* LC_COLLATE: Bash Variables. (line 570) +* LC_CTYPE: Bash Variables. (line 577) * LC_MESSAGES: Creating Internationalized Scripts. (line 51) -* LC_MESSAGES <1>: Bash Variables. (line 579) -* LC_NUMERIC: Bash Variables. (line 583) -* LC_TIME: Bash Variables. (line 587) -* LINENO: Bash Variables. (line 591) -* LINES: Bash Variables. (line 598) -* MACHTYPE: Bash Variables. (line 604) +* LC_MESSAGES <1>: Bash Variables. (line 582) +* LC_NUMERIC: Bash Variables. (line 586) +* LC_TIME: Bash Variables. (line 590) +* LINENO: Bash Variables. (line 594) +* LINES: Bash Variables. (line 601) +* MACHTYPE: Bash Variables. (line 607) * MAIL: Bourne Shell Variables. (line 24) -* MAILCHECK: Bash Variables. (line 608) +* MAILCHECK: Bash Variables. (line 611) * MAILPATH: Bourne Shell Variables. (line 29) -* MAPFILE: Bash Variables. (line 616) +* MAPFILE: Bash Variables. (line 619) * mark-modified-lines: Readline Init File Syntax. (line 308) * mark-symlinked-directories: Readline Init File Syntax. @@ -13349,46 +13367,46 @@ D.3 Parameter and Variable Index (line 325) * meta-flag: Readline Init File Syntax. (line 260) -* OLDPWD: Bash Variables. (line 620) +* OLDPWD: Bash Variables. (line 623) * OPTARG: Bourne Shell Variables. (line 36) -* OPTERR: Bash Variables. (line 623) +* OPTERR: Bash Variables. (line 626) * OPTIND: Bourne Shell Variables. (line 40) -* OSTYPE: Bash Variables. (line 628) +* OSTYPE: Bash Variables. (line 631) * output-meta: Readline Init File Syntax. (line 330) * page-completions: Readline Init File Syntax. (line 339) * PATH: Bourne Shell Variables. (line 44) -* PIPESTATUS: Bash Variables. (line 631) -* POSIXLY_CORRECT: Bash Variables. (line 641) -* PPID: Bash Variables. (line 651) -* PROMPT_COMMAND: Bash Variables. (line 655) -* PROMPT_DIRTRIM: Bash Variables. (line 661) -* PS0: Bash Variables. (line 667) +* PIPESTATUS: Bash Variables. (line 634) +* POSIXLY_CORRECT: Bash Variables. (line 644) +* PPID: Bash Variables. (line 654) +* PROMPT_COMMAND: Bash Variables. (line 658) +* PROMPT_DIRTRIM: Bash Variables. (line 664) +* PS0: Bash Variables. (line 670) * PS1: Bourne Shell Variables. (line 53) * PS2: Bourne Shell Variables. (line 58) -* PS3: Bash Variables. (line 672) -* PS4: Bash Variables. (line 677) -* PWD: Bash Variables. (line 685) -* RANDOM: Bash Variables. (line 688) -* READLINE_ARGUMENT: Bash Variables. (line 696) -* READLINE_LINE: Bash Variables. (line 700) -* READLINE_MARK: Bash Variables. (line 704) -* READLINE_POINT: Bash Variables. (line 710) -* REPLY: Bash Variables. (line 714) +* PS3: Bash Variables. (line 675) +* PS4: Bash Variables. (line 680) +* PWD: Bash Variables. (line 688) +* RANDOM: Bash Variables. (line 691) +* READLINE_ARGUMENT: Bash Variables. (line 699) +* READLINE_LINE: Bash Variables. (line 703) +* READLINE_MARK: Bash Variables. (line 707) +* READLINE_POINT: Bash Variables. (line 713) +* REPLY: Bash Variables. (line 717) * revert-all-at-newline: Readline Init File Syntax. (line 352) * search-ignore-case: Readline Init File Syntax. (line 359) -* SECONDS: Bash Variables. (line 718) -* SHELL: Bash Variables. (line 728) -* SHELLOPTS: Bash Variables. (line 733) -* SHLVL: Bash Variables. (line 743) +* SECONDS: Bash Variables. (line 721) +* SHELL: Bash Variables. (line 731) +* SHELLOPTS: Bash Variables. (line 736) +* SHLVL: Bash Variables. (line 746) * show-all-if-ambiguous: Readline Init File Syntax. (line 364) * show-all-if-unmodified: Readline Init File Syntax. @@ -13397,15 +13415,15 @@ D.3 Parameter and Variable Index (line 379) * skip-completed-text: Readline Init File Syntax. (line 385) -* SRANDOM: Bash Variables. (line 748) +* SRANDOM: Bash Variables. (line 751) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) * TEXTDOMAINDIR: Creating Internationalized Scripts. (line 51) -* TIMEFORMAT: Bash Variables. (line 757) -* TMOUT: Bash Variables. (line 796) -* TMPDIR: Bash Variables. (line 808) -* UID: Bash Variables. (line 812) +* TIMEFORMAT: Bash Variables. (line 760) +* TMOUT: Bash Variables. (line 799) +* TMPDIR: Bash Variables. (line 811) +* UID: Bash Variables. (line 815) * vi-cmd-mode-string: Readline Init File Syntax. (line 398) * vi-ins-mode-string: Readline Init File Syntax. @@ -13862,81 +13880,81 @@ Node: Bash Builtins182353 Node: Modifying Shell Behavior220088 Node: The Set Builtin220430 Node: The Shopt Builtin232556 -Node: Special Builtins250092 -Node: Shell Variables251081 -Node: Bourne Shell Variables251515 -Node: Bash Variables254023 -Node: Bash Features293307 -Node: Invoking Bash294321 -Node: Bash Startup Files301551 -Node: Interactive Shells306911 -Node: What is an Interactive Shell?307319 -Node: Is this Shell Interactive?307981 -Node: Interactive Shell Behavior308805 -Node: Bash Conditional Expressions312566 -Node: Shell Arithmetic317983 -Node: Aliases321310 -Node: Arrays324444 -Node: The Directory Stack332547 -Node: Directory Stack Builtins333344 -Node: Controlling the Prompt337789 -Node: The Restricted Shell340908 -Node: Bash POSIX Mode344001 -Node: Shell Compatibility Mode363960 -Node: Job Control372967 -Node: Job Control Basics373424 -Node: Job Control Builtins379792 -Node: Job Control Variables386580 -Node: Command Line Editing387811 -Node: Introduction and Notation389514 -Node: Readline Interaction391866 -Node: Readline Bare Essentials393054 -Node: Readline Movement Commands394862 -Node: Readline Killing Commands395858 -Node: Readline Arguments397881 -Node: Searching398971 -Node: Readline Init File401214 -Node: Readline Init File Syntax402517 -Node: Conditional Init Constructs429468 -Node: Sample Init File433853 -Node: Bindable Readline Commands436973 -Node: Commands For Moving438511 -Node: Commands For History440975 -Node: Commands For Text447132 -Node: Commands For Killing451257 -Node: Numeric Arguments454045 -Node: Commands For Completion455197 -Node: Keyboard Macros460893 -Node: Miscellaneous Commands461594 -Node: Readline vi Mode469137 -Node: Programmable Completion470114 -Node: Programmable Completion Builtins479850 -Node: A Programmable Completion Example491587 -Node: Using History Interactively496932 -Node: Bash History Facilities497613 -Node: Bash History Builtins501348 -Node: History Interaction508943 -Node: Event Designators513893 -Node: Word Designators515471 -Node: Modifiers517863 -Node: Installing Bash519800 -Node: Basic Installation520916 -Node: Compilers and Options524792 -Node: Compiling For Multiple Architectures525542 -Node: Installation Names527295 -Node: Specifying the System Type529529 -Node: Sharing Defaults530275 -Node: Operation Controls530989 -Node: Optional Features532008 -Node: Reporting Bugs544731 -Node: Major Differences From The Bourne Shell546088 -Node: GNU Free Documentation License567515 -Node: Indexes592692 -Node: Builtin Index593143 -Node: Reserved Word Index600241 -Node: Variable Index602686 -Node: Function Index620099 -Node: Concept Index634524 +Node: Special Builtins250104 +Node: Shell Variables251093 +Node: Bourne Shell Variables251527 +Node: Bash Variables254035 +Node: Bash Features293339 +Node: Invoking Bash294353 +Node: Bash Startup Files301583 +Node: Interactive Shells306943 +Node: What is an Interactive Shell?307351 +Node: Is this Shell Interactive?308013 +Node: Interactive Shell Behavior308837 +Node: Bash Conditional Expressions312598 +Node: Shell Arithmetic318015 +Node: Aliases321342 +Node: Arrays324476 +Node: The Directory Stack332579 +Node: Directory Stack Builtins333376 +Node: Controlling the Prompt337821 +Node: The Restricted Shell340940 +Node: Bash POSIX Mode344033 +Node: Shell Compatibility Mode363992 +Node: Job Control372999 +Node: Job Control Basics373456 +Node: Job Control Builtins379824 +Node: Job Control Variables386612 +Node: Command Line Editing387843 +Node: Introduction and Notation389546 +Node: Readline Interaction391898 +Node: Readline Bare Essentials393086 +Node: Readline Movement Commands394894 +Node: Readline Killing Commands395890 +Node: Readline Arguments397913 +Node: Searching399003 +Node: Readline Init File401246 +Node: Readline Init File Syntax402549 +Node: Conditional Init Constructs429500 +Node: Sample Init File433885 +Node: Bindable Readline Commands437005 +Node: Commands For Moving438543 +Node: Commands For History441007 +Node: Commands For Text447164 +Node: Commands For Killing451289 +Node: Numeric Arguments454077 +Node: Commands For Completion455229 +Node: Keyboard Macros460925 +Node: Miscellaneous Commands461626 +Node: Readline vi Mode469169 +Node: Programmable Completion470146 +Node: Programmable Completion Builtins479882 +Node: A Programmable Completion Example491619 +Node: Using History Interactively496964 +Node: Bash History Facilities497645 +Node: Bash History Builtins502311 +Node: History Interaction509906 +Node: Event Designators514856 +Node: Word Designators516434 +Node: Modifiers518826 +Node: Installing Bash520763 +Node: Basic Installation521879 +Node: Compilers and Options525755 +Node: Compiling For Multiple Architectures526505 +Node: Installation Names528258 +Node: Specifying the System Type530492 +Node: Sharing Defaults531238 +Node: Operation Controls531952 +Node: Optional Features532971 +Node: Reporting Bugs545694 +Node: Major Differences From The Bourne Shell547051 +Node: GNU Free Documentation License568478 +Node: Indexes593655 +Node: Builtin Index594106 +Node: Reserved Word Index601204 +Node: Variable Index603649 +Node: Function Index621062 +Node: Concept Index635487  End Tag Table diff --git a/doc/bashref.info b/doc/bashref.info index 7abd609a..be8c16d3 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 7.3 from bashref.texi. This text is a brief description of the features that are present in the -Bash shell (version 5.4, 20 August 2026). +Bash shell (version 5.4, 27 August 2026). - This is Edition 5.4, last updated 20 August 2026, of ‘The GNU Bash + This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.4. Copyright © 1988-2026 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.4, 20 August 2026). The Bash home page is +Bash shell (version 5.4, 27 August 2026). The Bash home page is . - This is Edition 5.4, last updated 20 August 2026, of ‘The GNU Bash + This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash Reference Manual’, for ‘Bash’, Version 5.4. Bash contains features that appear in other popular shells, and some @@ -5431,7 +5431,7 @@ This builtin allows you to change additional optional shell behavior. ‘histappend’ If set, the history list is appended to the file named by the value of the ‘HISTFILE’ variable when the shell exits, rather - than overwriting the file. + than potentially overwriting the file. ‘histreedit’ If set, and Readline is being used, the user is given the @@ -6162,15 +6162,18 @@ Variables::). exits. ‘HISTFILESIZE’ - The maximum number of lines contained in the history file. When - this variable is assigned a value, the history file is truncated, - if necessary, to contain no more than the number of history entries - that total no more than that number of lines by removing the oldest - entries. If the history list contains multi-line entries, the - history file may contain more lines than this maximum to avoid - leaving partial history entries. The history file is also - truncated to this size after writing it when a shell exits or by - the ‘history’ builtin. If the value is 0, the history file is + The maximum number of lines or history entries contained in the + history file. When this variable is assigned a value, the history + file is truncated, if necessary, to contain no more than that + number of history entries or lines, depending on the value of + ‘HISTTIMEFORMAT’, by removing the oldest entries. + + *Note Bash History Facilities::, for a description of how + ‘HISTTIMEFORMAT’ affects how the value is treated and whether it + refers to lines or history entries. + + The history file is also truncated to this size after writing it + when a shell exits. If the value is 0, the history file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation. The shell sets the default value to the value of ‘HISTSIZE’ after reading any startup files. @@ -11013,10 +11016,21 @@ the values of the shell variables ‘HISTIGNORE’ and ‘HISTCONTROL’. reading history entries from the file named by the ‘HISTFILE’ variable (default ‘~/.bash_history’). This is referred to as the “history file”. The history file is truncated, if necessary, to contain no more than the -number of history entries specified by the value of the ‘HISTFILESIZE’ -variable. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric -value, or a numeric value less than zero, the history file is not -truncated. +number of lines or history entries specified by the value of the +‘HISTFILESIZE’ variable. + + The value of ‘HISTFILESIZE’ is interpreted as lines or possibly +multi-line history entries depending on whether the ‘HISTTIMEFORMAT’ +variable has a value, since that controls whether or not timestamps are +written to the history file. If ‘HISTTIMEFORMAT’ has a value, +‘HISTFILESIZE’ is interpreted as a number of history entries, including +timestamps. If it does not, ‘HISTFILESIZE’ is interpreted as a number +of lines, which may result in incomplete history entries in the history +file, or the history file containing more lines than this maximum to +avoid leaving partial history entries. + + If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric value, or a +numeric value less than zero, the history file is not truncated. When the history file is read, lines beginning with the history comment character followed immediately by a digit are interpreted as @@ -11025,14 +11039,18 @@ optionally displayed depending on the value of the ‘HISTTIMEFORMAT’ variable (*note Bash Variables::). When present, history timestamps delimit history entries, making multi-line entries possible. - When a shell with history enabled exits, Bash copies the last + When a shell with history enabled exits, Bash copies up to the last ‘$HISTSIZE’ entries from the history list to the file named by ‘$HISTFILE’. If the ‘histappend’ shell option is set (*note Bash -Builtins::), Bash appends the entries to the history file, otherwise it -overwrites the history file. If ‘HISTFILE’ is unset or null, or if the -history file is unwritable, the history is not saved. After saving the -history, Bash truncates the history file to contain no more than -‘$HISTFILESIZE’ lines as described above. +Builtins::), or if the number of history entries entered during the +current shell session is less than ‘$HISTSIZE’, Bash appends the history +entries entered during the current session to ‘$HISTFILE’. If +‘histappend’ is not set, and the number of entries from the current +shell session exceeds ‘$HISTSIZE’, it overwrites the history file with +the entries from the current session. If ‘HISTFILE’ is unset or null, +or if the history file is unwritable, the history is not saved. After +saving the history, Bash truncates the history file to contain no more +than ‘$HISTFILESIZE’ entries as described above. If the ‘HISTTIMEFORMAT’ variable is set, the shell writes the timestamp information associated with each history entry to the history @@ -13295,51 +13313,51 @@ D.3 Parameter and Variable Index * HISTCONTROL: Bash Variables. (line 445) * HISTFILE: Bash Variables. (line 463) * HISTFILESIZE: Bash Variables. (line 469) -* HISTIGNORE: Bash Variables. (line 483) +* HISTIGNORE: Bash Variables. (line 486) * history-preserve-point: Readline Init File Syntax. (line 236) * history-size: Readline Init File Syntax. (line 242) -* HISTSIZE: Bash Variables. (line 507) -* HISTTIMEFORMAT: Bash Variables. (line 514) +* HISTSIZE: Bash Variables. (line 510) +* HISTTIMEFORMAT: Bash Variables. (line 517) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. (line 252) -* HOSTFILE: Bash Variables. (line 523) -* HOSTNAME: Bash Variables. (line 534) -* HOSTTYPE: Bash Variables. (line 537) +* HOSTFILE: Bash Variables. (line 526) +* HOSTNAME: Bash Variables. (line 537) +* HOSTTYPE: Bash Variables. (line 540) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 540) +* IGNOREEOF: Bash Variables. (line 543) * input-meta: Readline Init File Syntax. (line 260) -* INPUTRC: Bash Variables. (line 549) -* INSIDE_EMACS: Bash Variables. (line 553) +* INPUTRC: Bash Variables. (line 552) +* INSIDE_EMACS: Bash Variables. (line 556) * isearch-terminators: Readline Init File Syntax. (line 271) * keymap: Readline Init File Syntax. (line 278) * LANG: Creating Internationalized Scripts. (line 51) -* LANG <1>: Bash Variables. (line 559) -* LC_ALL: Bash Variables. (line 563) -* LC_COLLATE: Bash Variables. (line 567) -* LC_CTYPE: Bash Variables. (line 574) +* LANG <1>: Bash Variables. (line 562) +* LC_ALL: Bash Variables. (line 566) +* LC_COLLATE: Bash Variables. (line 570) +* LC_CTYPE: Bash Variables. (line 577) * LC_MESSAGES: Creating Internationalized Scripts. (line 51) -* LC_MESSAGES <1>: Bash Variables. (line 579) -* LC_NUMERIC: Bash Variables. (line 583) -* LC_TIME: Bash Variables. (line 587) -* LINENO: Bash Variables. (line 591) -* LINES: Bash Variables. (line 598) -* MACHTYPE: Bash Variables. (line 604) +* LC_MESSAGES <1>: Bash Variables. (line 582) +* LC_NUMERIC: Bash Variables. (line 586) +* LC_TIME: Bash Variables. (line 590) +* LINENO: Bash Variables. (line 594) +* LINES: Bash Variables. (line 601) +* MACHTYPE: Bash Variables. (line 607) * MAIL: Bourne Shell Variables. (line 24) -* MAILCHECK: Bash Variables. (line 608) +* MAILCHECK: Bash Variables. (line 611) * MAILPATH: Bourne Shell Variables. (line 29) -* MAPFILE: Bash Variables. (line 616) +* MAPFILE: Bash Variables. (line 619) * mark-modified-lines: Readline Init File Syntax. (line 308) * mark-symlinked-directories: Readline Init File Syntax. @@ -13350,46 +13368,46 @@ D.3 Parameter and Variable Index (line 325) * meta-flag: Readline Init File Syntax. (line 260) -* OLDPWD: Bash Variables. (line 620) +* OLDPWD: Bash Variables. (line 623) * OPTARG: Bourne Shell Variables. (line 36) -* OPTERR: Bash Variables. (line 623) +* OPTERR: Bash Variables. (line 626) * OPTIND: Bourne Shell Variables. (line 40) -* OSTYPE: Bash Variables. (line 628) +* OSTYPE: Bash Variables. (line 631) * output-meta: Readline Init File Syntax. (line 330) * page-completions: Readline Init File Syntax. (line 339) * PATH: Bourne Shell Variables. (line 44) -* PIPESTATUS: Bash Variables. (line 631) -* POSIXLY_CORRECT: Bash Variables. (line 641) -* PPID: Bash Variables. (line 651) -* PROMPT_COMMAND: Bash Variables. (line 655) -* PROMPT_DIRTRIM: Bash Variables. (line 661) -* PS0: Bash Variables. (line 667) +* PIPESTATUS: Bash Variables. (line 634) +* POSIXLY_CORRECT: Bash Variables. (line 644) +* PPID: Bash Variables. (line 654) +* PROMPT_COMMAND: Bash Variables. (line 658) +* PROMPT_DIRTRIM: Bash Variables. (line 664) +* PS0: Bash Variables. (line 670) * PS1: Bourne Shell Variables. (line 53) * PS2: Bourne Shell Variables. (line 58) -* PS3: Bash Variables. (line 672) -* PS4: Bash Variables. (line 677) -* PWD: Bash Variables. (line 685) -* RANDOM: Bash Variables. (line 688) -* READLINE_ARGUMENT: Bash Variables. (line 696) -* READLINE_LINE: Bash Variables. (line 700) -* READLINE_MARK: Bash Variables. (line 704) -* READLINE_POINT: Bash Variables. (line 710) -* REPLY: Bash Variables. (line 714) +* PS3: Bash Variables. (line 675) +* PS4: Bash Variables. (line 680) +* PWD: Bash Variables. (line 688) +* RANDOM: Bash Variables. (line 691) +* READLINE_ARGUMENT: Bash Variables. (line 699) +* READLINE_LINE: Bash Variables. (line 703) +* READLINE_MARK: Bash Variables. (line 707) +* READLINE_POINT: Bash Variables. (line 713) +* REPLY: Bash Variables. (line 717) * revert-all-at-newline: Readline Init File Syntax. (line 352) * search-ignore-case: Readline Init File Syntax. (line 359) -* SECONDS: Bash Variables. (line 718) -* SHELL: Bash Variables. (line 728) -* SHELLOPTS: Bash Variables. (line 733) -* SHLVL: Bash Variables. (line 743) +* SECONDS: Bash Variables. (line 721) +* SHELL: Bash Variables. (line 731) +* SHELLOPTS: Bash Variables. (line 736) +* SHLVL: Bash Variables. (line 746) * show-all-if-ambiguous: Readline Init File Syntax. (line 364) * show-all-if-unmodified: Readline Init File Syntax. @@ -13398,15 +13416,15 @@ D.3 Parameter and Variable Index (line 379) * skip-completed-text: Readline Init File Syntax. (line 385) -* SRANDOM: Bash Variables. (line 748) +* SRANDOM: Bash Variables. (line 751) * TEXTDOMAIN: Creating Internationalized Scripts. (line 51) * TEXTDOMAINDIR: Creating Internationalized Scripts. (line 51) -* TIMEFORMAT: Bash Variables. (line 757) -* TMOUT: Bash Variables. (line 796) -* TMPDIR: Bash Variables. (line 808) -* UID: Bash Variables. (line 812) +* TIMEFORMAT: Bash Variables. (line 760) +* TMOUT: Bash Variables. (line 799) +* TMPDIR: Bash Variables. (line 811) +* UID: Bash Variables. (line 815) * vi-cmd-mode-string: Readline Init File Syntax. (line 398) * vi-ins-mode-string: Readline Init File Syntax. @@ -13863,81 +13881,81 @@ Node: Bash Builtins182515 Node: Modifying Shell Behavior220253 Node: The Set Builtin220598 Node: The Shopt Builtin232727 -Node: Special Builtins250266 -Node: Shell Variables251258 -Node: Bourne Shell Variables251695 -Node: Bash Variables254206 -Node: Bash Features293493 -Node: Invoking Bash294510 -Node: Bash Startup Files301743 -Node: Interactive Shells307106 -Node: What is an Interactive Shell?307517 -Node: Is this Shell Interactive?308182 -Node: Interactive Shell Behavior309009 -Node: Bash Conditional Expressions312773 -Node: Shell Arithmetic318193 -Node: Aliases321523 -Node: Arrays324660 -Node: The Directory Stack332766 -Node: Directory Stack Builtins333566 -Node: Controlling the Prompt338014 -Node: The Restricted Shell341136 -Node: Bash POSIX Mode344232 -Node: Shell Compatibility Mode364194 -Node: Job Control373204 -Node: Job Control Basics373664 -Node: Job Control Builtins380035 -Node: Job Control Variables386826 -Node: Command Line Editing388060 -Node: Introduction and Notation389766 -Node: Readline Interaction392121 -Node: Readline Bare Essentials393312 -Node: Readline Movement Commands395123 -Node: Readline Killing Commands396122 -Node: Readline Arguments398148 -Node: Searching399241 -Node: Readline Init File401487 -Node: Readline Init File Syntax402793 -Node: Conditional Init Constructs429747 -Node: Sample Init File434135 -Node: Bindable Readline Commands437258 -Node: Commands For Moving438799 -Node: Commands For History441266 -Node: Commands For Text447426 -Node: Commands For Killing451554 -Node: Numeric Arguments454345 -Node: Commands For Completion455500 -Node: Keyboard Macros461199 -Node: Miscellaneous Commands461903 -Node: Readline vi Mode469449 -Node: Programmable Completion470429 -Node: Programmable Completion Builtins480168 -Node: A Programmable Completion Example491908 -Node: Using History Interactively497256 -Node: Bash History Facilities497940 -Node: Bash History Builtins501678 -Node: History Interaction509276 -Node: Event Designators514229 -Node: Word Designators515810 -Node: Modifiers518205 -Node: Installing Bash520145 -Node: Basic Installation521264 -Node: Compilers and Options525143 -Node: Compiling For Multiple Architectures525896 -Node: Installation Names527652 -Node: Specifying the System Type529889 -Node: Sharing Defaults530638 -Node: Operation Controls531355 -Node: Optional Features532377 -Node: Reporting Bugs545103 -Node: Major Differences From The Bourne Shell546463 -Node: GNU Free Documentation License567893 -Node: Indexes593073 -Node: Builtin Index593527 -Node: Reserved Word Index600628 -Node: Variable Index603076 -Node: Function Index620492 -Node: Concept Index634920 +Node: Special Builtins250278 +Node: Shell Variables251270 +Node: Bourne Shell Variables251707 +Node: Bash Variables254218 +Node: Bash Features293525 +Node: Invoking Bash294542 +Node: Bash Startup Files301775 +Node: Interactive Shells307138 +Node: What is an Interactive Shell?307549 +Node: Is this Shell Interactive?308214 +Node: Interactive Shell Behavior309041 +Node: Bash Conditional Expressions312805 +Node: Shell Arithmetic318225 +Node: Aliases321555 +Node: Arrays324692 +Node: The Directory Stack332798 +Node: Directory Stack Builtins333598 +Node: Controlling the Prompt338046 +Node: The Restricted Shell341168 +Node: Bash POSIX Mode344264 +Node: Shell Compatibility Mode364226 +Node: Job Control373236 +Node: Job Control Basics373696 +Node: Job Control Builtins380067 +Node: Job Control Variables386858 +Node: Command Line Editing388092 +Node: Introduction and Notation389798 +Node: Readline Interaction392153 +Node: Readline Bare Essentials393344 +Node: Readline Movement Commands395155 +Node: Readline Killing Commands396154 +Node: Readline Arguments398180 +Node: Searching399273 +Node: Readline Init File401519 +Node: Readline Init File Syntax402825 +Node: Conditional Init Constructs429779 +Node: Sample Init File434167 +Node: Bindable Readline Commands437290 +Node: Commands For Moving438831 +Node: Commands For History441298 +Node: Commands For Text447458 +Node: Commands For Killing451586 +Node: Numeric Arguments454377 +Node: Commands For Completion455532 +Node: Keyboard Macros461231 +Node: Miscellaneous Commands461935 +Node: Readline vi Mode469481 +Node: Programmable Completion470461 +Node: Programmable Completion Builtins480200 +Node: A Programmable Completion Example491940 +Node: Using History Interactively497288 +Node: Bash History Facilities497972 +Node: Bash History Builtins502641 +Node: History Interaction510239 +Node: Event Designators515192 +Node: Word Designators516773 +Node: Modifiers519168 +Node: Installing Bash521108 +Node: Basic Installation522227 +Node: Compilers and Options526106 +Node: Compiling For Multiple Architectures526859 +Node: Installation Names528615 +Node: Specifying the System Type530852 +Node: Sharing Defaults531601 +Node: Operation Controls532318 +Node: Optional Features533340 +Node: Reporting Bugs546066 +Node: Major Differences From The Bourne Shell547426 +Node: GNU Free Documentation License568856 +Node: Indexes594036 +Node: Builtin Index594490 +Node: Reserved Word Index601591 +Node: Variable Index604039 +Node: Function Index621455 +Node: Concept Index635883  End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index ca03ac60..81608eee 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -6560,7 +6560,8 @@ message format. @item histappend If set, the history list is appended to the file named by the value of the @env{HISTFILE} -variable when the shell exits, rather than overwriting the file. +variable when the shell exits, rather than +potentially overwriting the file. @item histreedit If set, and Readline is being used, @@ -7407,17 +7408,22 @@ If @env{HISTFILE} is unset or null, the shell does not save the command history when it exits. @item HISTFILESIZE -The maximum number of lines contained in the history file. -When this variable is assigned a value, the history file is truncated, -if necessary, to contain no more than -the number of history entries -that total no more than that number of lines +The maximum number of lines or history entries contained in the history file. +When this variable is assigned a value, +the history file is truncated, if necessary, +to contain no more than +that number of history entries or lines, +depending on the value of @env{HISTTIMEFORMAT}, by removing the oldest entries. -If the history list contains multi-line entries, -the history file may contain more lines than this maximum -to avoid leaving partial history entries. + +@xref{Bash History Facilities}, +for a description of how +@env{HISTTIMEFORMAT} +affects how the value is treated and +whether it refers to lines or history entries. + The history file is also truncated to this size after -writing it when a shell exits or by the @code{history} builtin. +writing it when a shell exits. If the value is 0, the history file is truncated to zero size. Non-numeric values and numeric values less than zero inhibit truncation. The shell sets the default value to the value of @env{HISTSIZE} diff --git a/doc/version.texi b/doc/version.texi index 641f82f0..16ed904f 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -2,10 +2,10 @@ Copyright (C) 1988-2026 Free Software Foundation, Inc. @end ignore -@set LASTCHANGE Thu Aug 20 11:42:13 EDT 2026 +@set LASTCHANGE Thu Aug 27 13:00:35 EDT 2026 @set EDITION 5.4 @set VERSION 5.4 -@set UPDATED 20 August 2026 +@set UPDATED 27 August 2026 @set UPDATED-MONTH August 2026 diff --git a/examples/loadables/asort.c b/examples/loadables/asort.c index 00a34364..e3627cc6 100644 --- a/examples/loadables/asort.c +++ b/examples/loadables/asort.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2020,2022-2024 Free Software Foundation, Inc. + Copyright (C) 2020,2022-2026 Free Software Foundation, Inc. Bash is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,12 +38,14 @@ typedef struct sort_element { static int reverse_flag; static int numeric_flag; +static int index_flag; static int compare(const void *p1, const void *p2) { const sort_element e1 = *(sort_element *) p1; const sort_element e2 = *(sort_element *) p2; + char *x1, *x2; if (numeric_flag) { if (reverse_flag) @@ -52,10 +54,14 @@ compare(const void *p1, const void *p2) return (e1.num > e2.num) ? 1 : (e1.num < e2.num) ? -1 : 0; } else { - if (reverse_flag) - return strcoll(e2.value, e1.value); - else - return strcoll(e1.value, e2.value); + if (index_flag == 2 && e1.key && e2.key) { /* associative array with -I */ + x1 = e1.key; + x2 = e2.key; + } else { + x1 = e1.value; + x2 = e2.value; + } + return (reverse_flag ? strcoll(x2, x1) strcoll(x1, x2)); } } @@ -99,6 +105,7 @@ sort_index(SHELL_VAR *dest, SHELL_VAR *source) i = 0; for (ae = element_forw(array->head); ae != array->head; ae = element_forw(ae)) { + sa[i].key = NULL; sa[i].v = ae; if (numeric_flag) sa[i].num = strtod(element_value(ae), NULL); @@ -188,15 +195,15 @@ asort_builtin(WORD_LIST *list) SHELL_VAR *var, *var2; char *word; int opt, ret; - int index_flag = 0; - numeric_flag = 0; - reverse_flag = 0; + + numeric_flag = reverse_flag = index_flag = 0; reset_internal_getopt(); - while ((opt = internal_getopt(list, "inr")) != -1) { + while ((opt = internal_getopt(list, "inrI")) != -1) { switch (opt) { case 'i': index_flag = 1; break; + case 'I': index_flag = 2; break; case 'n': numeric_flag = 1; break; case 'r': reverse_flag = 1; break; CASE_HELPOPT; @@ -228,10 +235,10 @@ asort_builtin(WORD_LIST *list) } var2 = find_variable(list->next->word->word); if ( !var2 || ( !array_p(var2) && !assoc_p(var2) ) ) { - builtin_error("%s: Not an array", list->next->word->word); + builtin_error("%s: not an array", list->next->word->word); return EXECUTION_FAILURE; } - var = builtin_find_indexed_array(list->word->word, 1); + var = builtin_find_indexed_array(list->word->word, 0); if (var == 0) return EXECUTION_FAILURE; return sort_index(var, var2); @@ -266,10 +273,15 @@ char *asort_doc[] = { " -n compare according to string numerical value", " -r reverse the result of comparisons", " -i sort using indices/keys", + " -I sort associative arrays using values", "", "If -i is supplied, SOURCE is not sorted in-place, but the indices (or keys", "if associative) of SOURCE, after sorting it by its values, are placed as", - "values in the indexed array DEST", + "values in the indexed array DEST.", + "", + "If -I is supplied instead, SOURCE is sorted by its keys and those keys", + "are placed, in order, as values in the indexed array DEST. This only", + "makes sense for associative arrays.", "", "Associative arrays may not be sorted in-place.", "", @@ -284,6 +296,6 @@ struct builtin asort_struct = { asort_builtin, BUILTIN_ENABLED, asort_doc, - "asort [-nr] array ... or asort [-nr] -i dest source", + "asort [-nr] array ... or asort [-nr] -i|-I dest source", 0 }; diff --git a/lib/readline/doc/hsuser.texi b/lib/readline/doc/hsuser.texi index 517745e5..f121c8b7 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -85,8 +85,26 @@ by reading history entries from the file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). This is referred to as the @dfn{history file}. The history file is truncated, if necessary, -to contain no more than the number of history entries +to contain no more than the number of lines or history entries specified by the value of the @env{HISTFILESIZE} variable. + +The value of @env{HISTFILESIZE} +is interpreted as lines or possibly multi-line history +entries depending on whether the @env{HISTTIMEFORMAT} +variable has a value, +since that controls whether or not timestamps are written +to the history file. +If @env{HISTTIMEFORMAT} +has a value, +@env{HISTFILESIZE} +is interpreted as a number of +history entries, including timestamps. +If it does not, @env{HISTFILESIZE} +is interpreted as a number of lines, +which may result in incomplete history entries in the history file, +or the history file containing more lines than this maximum +to avoid leaving partial history entries. + If @env{HISTFILESIZE} is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated. @@ -98,17 +116,26 @@ These timestamps are optionally displayed depending on the value of the When present, history timestamps delimit history entries, making multi-line entries possible. -When a shell with history enabled exits, Bash copies the last -@env{$HISTSIZE} entries from the history list to the file -named by @env{$HISTFILE}. +When a shell with history enabled exits, Bash +copies up to the last +@env{$HISTSIZE} +entries from the history list +to the file named by +@env{$HISTFILE}. If the @code{histappend} shell option is set (@pxref{Bash Builtins}), -Bash appends the entries to the history file, -otherwise it overwrites the history file. +or if the number of history entries entered +during the current shell session is less than +@env{$HISTSIZE}, +Bash appends the history entries entered during the current session +to @env{$HISTFILE}. +If @code{histappend} is not set, and the number of entries from the current +shell session exceeds @env{$HISTSIZE}, +it overwrites the history file with the entries from the current session. If @env{HISTFILE} is unset or null, or if the history file is unwritable, the history is not saved. After saving the history, Bash truncates the history file to contain no more than @env{$HISTFILESIZE} -lines as described above. +entries as described above. If the @env{HISTTIMEFORMAT} variable is set, the shell writes the timestamp information diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c index a676014c..9e39488c 100644 --- a/lib/readline/histfile.c +++ b/lib/readline/histfile.c @@ -613,6 +613,7 @@ history_truncate_file (const char *fname, int lines) { char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */ int file, chars_read, rv, orig_lines, exists, r; + int has_timestamps; struct stat finfo, nfinfo; size_t file_size; @@ -695,6 +696,11 @@ history_truncate_file (const char *fname, int lines) } buffer[chars_read] = '\0'; /* for the initial check of bp1[1] */ + /* use a heuristic like in read_history_range() to determine whether the + file has timestamps, but don't change the comment character so + HIST_TIMESTAMP_START doesn't return true */ + has_timestamps = history_comment_char == '\0' && buffer[0] == '#' && isdigit ((unsigned char)buffer[1]); + /* Count backwards from the end of buffer until we have passed LINES lines. bp1 is set funny initially. But since bp[1] can't be a comment character (since it's off the end) and *bp can't be @@ -703,6 +709,8 @@ history_truncate_file (const char *fname, int lines) because we decrement it one extra time the first time through the loop and we need the final timestamp line. */ lines += history_write_timestamps; + if (history_write_timestamps == 0) + lines += has_timestamps; /* do our best */ for (bp1 = bp = buffer + chars_read - 1; lines > 0 && bp > buffer; bp--) { if (*bp == '\n' && HIST_TIMESTAMP_START(bp1) == 0)