summaryrefslogtreecommitdiff
path: root/doc/bash.0
diff options
context:
space:
mode:
Diffstat (limited to 'doc/bash.0')
-rw-r--r--doc/bash.02125
1 files changed, 1075 insertions, 1050 deletions
diff --git a/doc/bash.0 b/doc/bash.0
index 3f7edce6..a998b6e9 100644
--- a/doc/bash.0
+++ b/doc/bash.0
@@ -1289,18 +1289,18 @@ EEXXPPAANNSSIIOONN
are not sorted; left to right order is preserved. For example,
a{{d,c,b}}e expands into `ade ace abe'.
- A sequence expression takes the form {{_x...._y[[...._i_n_c_r]]}}_, _w_h_e_r_e _x _a_n_d _y _a_r_e
- _e_i_t_h_e_r _i_n_t_e_g_e_r_s _o_r _s_i_n_g_l_e _c_h_a_r_a_c_t_e_r_s_, _a_n_d _i_n_c_r_, _a_n _o_p_t_i_o_n_a_l _i_n_c_r_e_m_e_n_t_,
- _i_s _a_n _i_n_t_e_g_e_r_. _W_h_e_n _i_n_t_e_g_e_r_s _a_r_e _s_u_p_p_l_i_e_d_, _t_h_e _e_x_p_r_e_s_s_i_o_n _e_x_p_a_n_d_s _t_o
- _e_a_c_h _n_u_m_b_e_r _b_e_t_w_e_e_n _x _a_n_d _y_, _i_n_c_l_u_s_i_v_e_. _S_u_p_p_l_i_e_d _i_n_t_e_g_e_r_s _m_a_y _b_e _p_r_e_-
- _f_i_x_e_d _w_i_t_h _0 _t_o _f_o_r_c_e _e_a_c_h _t_e_r_m _t_o _h_a_v_e _t_h_e _s_a_m_e _w_i_d_t_h_. _W_h_e_n _e_i_t_h_e_r _x
- _o_r _y _b_e_g_i_n_s _w_i_t_h _a _z_e_r_o_, _t_h_e _s_h_e_l_l _a_t_t_e_m_p_t_s _t_o _f_o_r_c_e _a_l_l _g_e_n_e_r_a_t_e_d
- _t_e_r_m_s _t_o _c_o_n_t_a_i_n _t_h_e _s_a_m_e _n_u_m_b_e_r _o_f _d_i_g_i_t_s_, _z_e_r_o_-_p_a_d_d_i_n_g _w_h_e_r_e _n_e_c_e_s_-
- _s_a_r_y_. _W_h_e_n _c_h_a_r_a_c_t_e_r_s _a_r_e _s_u_p_p_l_i_e_d_, _t_h_e _e_x_p_r_e_s_s_i_o_n _e_x_p_a_n_d_s _t_o _e_a_c_h
- _c_h_a_r_a_c_t_e_r _l_e_x_i_c_o_g_r_a_p_h_i_c_a_l_l_y _b_e_t_w_e_e_n _x _a_n_d _y_, _i_n_c_l_u_s_i_v_e_. _N_o_t_e _t_h_a_t _b_o_t_h
- _x _a_n_d _y _m_u_s_t _b_e _o_f _t_h_e _s_a_m_e _t_y_p_e_. _W_h_e_n _t_h_e _i_n_c_r_e_m_e_n_t _i_s _s_u_p_p_l_i_e_d_, _i_t
- _i_s _u_s_e_d _a_s _t_h_e _d_i_f_f_e_r_e_n_c_e _b_e_t_w_e_e_n _e_a_c_h _t_e_r_m_. _T_h_e _d_e_f_a_u_l_t _i_n_c_r_e_m_e_n_t _i_s
- _1 _o_r _-_1 _a_s _a_p_p_r_o_p_r_i_a_t_e_.
+ A sequence expression takes the form {{_x...._y[[...._i_n_c_r]]}}, where _x and _y are
+ either integers or single characters, and _i_n_c_r, an optional increment,
+ is an integer. When integers are supplied, the expression expands to
+ each number between _x and _y, inclusive. Supplied integers may be pre-
+ fixed with _0 to force each term to have the same width. When either _x
+ or _y begins with a zero, the shell attempts to force all generated
+ terms to contain the same number of digits, zero-padding where neces-
+ sary. When characters are supplied, the expression expands to each
+ character lexicographically between _x and _y, inclusive. Note that both
+ _x and _y must be of the same type. When the increment is supplied, it
+ is used as the difference between each term. The default increment is
+ 1 or -1 as appropriate.
Brace expansion is performed before any other expansions, and any char-
acters special to other expansions are preserved in the result. It is
@@ -1439,89 +1439,90 @@ EEXXPPAANNSSIIOONN
${!!_p_r_e_f_i_x**}
${!!_p_r_e_f_i_x@@}
- 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 double quotes,
- each variable name expands to a separate word.
+ 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 double quotes, each variable name expands to a separate
+ word.
${!!_n_a_m_e[_@]}
${!!_n_a_m_e[_*]}
- 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 expands
- to a separate word.
+ 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 expands to a separate word.
${##_p_a_r_a_m_e_t_e_r}
- The length in characters of the value of _p_a_r_a_m_e_t_e_r is substi-
- tuted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value substituted 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 number of
- elements in the array.
+ PPaarraammeetteerr lleennggtthh.. The length in characters of the value of
+ _p_a_r_a_m_e_t_e_r is substituted. If _p_a_r_a_m_e_t_e_r is ** or @@, the value
+ substituted 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 substi-
+ tuted is the number of elements in the array.
${_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}
- The _w_o_r_d is expanded to produce a pattern just as in pathname
- expansion. 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 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 pattern removal operation is applied to each
- member of the array in turn, and the expansion is the resultant
- list.
+ RReemmoovvee mmaattcchhiinngg pprreeffiixx ppaatttteerrnn.. The _w_o_r_d is expanded to produce
+ a pattern just as in pathname expansion. 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 pat-
+ tern (the ``####'' case) deleted. If _p_a_r_a_m_e_t_e_r is @@ or **, the
+ pattern removal operation is applied to each positional parame-
+ ter 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 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%%_w_o_r_d}
${_p_a_r_a_m_e_t_e_r%%%%_w_o_r_d}
- The _w_o_r_d is expanded to produce a pattern just as in pathname
- expansion. 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 pat-
- tern (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 resultant 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.
+ RReemmoovvee mmaattcchhiinngg ssuuffffiixx ppaatttteerrnn.. The _w_o_r_d is expanded to produce
+ a pattern just as in pathname expansion. 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 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 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}
- The _p_a_t_t_e_r_n is expanded to produce a pattern just as in pathname
- expansion. _P_a_r_a_m_e_t_e_r is expanded and the longest match of _p_a_t_-
- _t_e_r_n against its value is replaced with _s_t_r_i_n_g. If _p_a_t_t_e_r_n
- begins with //, all matches of _p_a_t_t_e_r_n are replaced with _s_t_r_i_n_g.
- Normally only the first match is replaced. If _p_a_t_t_e_r_n begins
- with ##, it must match at the beginning of the expanded value of
- _p_a_r_a_m_e_t_e_r. If _p_a_t_t_e_r_n begins with %%, it must match at the end
- of the expanded value of _p_a_r_a_m_e_t_e_r. If _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 omit-
- ted. 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 resultant list. If _p_a_r_a_m_e_t_e_r is an array variable sub-
- scripted with @@ or **, the substitution operation is applied to
- each member of the array in turn, and the expansion is the
- resultant list.
+ PPaatttteerrnn ssuubbssttiittuuttiioonn.. The _p_a_t_t_e_r_n is expanded to produce a pat-
+ tern just as in pathname expansion. _P_a_r_a_m_e_t_e_r is expanded and
+ the longest match of _p_a_t_t_e_r_n against its value is replaced with
+ _s_t_r_i_n_g. If _p_a_t_t_e_r_n begins with //, all matches of _p_a_t_t_e_r_n are
+ replaced with _s_t_r_i_n_g. Normally only the first match is
+ replaced. If _p_a_t_t_e_r_n begins with ##, 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 begins with
+ %%, it must match at the end of the expanded value of _p_a_r_a_m_e_t_e_r.
+ If _s_t_r_i_n_g is null, matches of _p_a_t_t_e_r_n are deleted and the // fol-
+ lowing _p_a_t_t_e_r_n may be omitted. If _p_a_r_a_m_e_t_e_r is @@ or **, the sub-
+ stitution 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 substitution
+ 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}
${_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}
- This expansion modifies the case of alphabetic characters in
- _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to produce a pattern just as
- in pathname expansion. The ^^ operator converts lowercase let-
- ters matching _p_a_t_t_e_r_n to uppercase; the ,, operator converts
- matching uppercase letters to lowercase. The ^^^^ and ,,,, expan-
- sions convert each matched character in the expanded value; the
- ^^ and ,, expansions match and convert only the first character.
- 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 resultant list. If _p_a_r_a_m_e_t_e_r is an array
- variable subscripted with @@ or **, the case modification opera-
- tion is applied to each member of the array in turn, and the
- expansion is the resultant list.
+ CCaassee mmooddiiffiiccaattiioonn.. This expansion modifies the case of alpha-
+ betic characters in _p_a_r_a_m_e_t_e_r. The _p_a_t_t_e_r_n is expanded to pro-
+ duce a pattern just as in pathname expansion. The ^^ operator
+ converts lowercase letters matching _p_a_t_t_e_r_n to uppercase; the ,,
+ operator converts matching uppercase letters to lowercase. The
+ ^^^^ and ,,,, expansions convert each matched character in the
+ expanded value; the ^^ and ,, expansions match and convert only
+ the first character. 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 param-
+ eter 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 case
+ modification operation is applied to each member of the array in
+ turn, and the expansion is the resultant list.
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 com-
@@ -1533,160 +1534,160 @@ EEXXPPAANNSSIIOONN
``_c_o_m_m_a_n_d``
BBaasshh performs the expansion by executing _c_o_m_m_a_n_d and replacing the com-
- mand substitution with the standard output of the command, with any
+ mand substitution with the standard output of the command, with any
trailing newlines deleted. Embedded newlines are not deleted, but they
- may be removed during word splitting. The command substitution $$((ccaatt
+ may be removed during word splitting. The command substitution $$((ccaatt
_f_i_l_e)) can be replaced by the equivalent but faster $$((<< _f_i_l_e)).
- When the old-style backquote form of substitution is used, backslash
- retains its literal meaning except when followed by $$, ``, or \\. The
+ When the old-style backquote form of substitution is used, backslash
+ retains its literal meaning except when followed by $$, ``, or \\. The
first backquote not preceded by a backslash terminates the command sub-
- stitution. When using the $(_c_o_m_m_a_n_d) form, all characters between the
+ stitution. When using the $(_c_o_m_m_a_n_d) form, all characters between the
parentheses make up the command; none are treated specially.
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, word splitting and
+ If the substitution appears within double quotes, word splitting and
pathname expansion are not performed on the results.
AArriitthhmmeettiicc EExxppaannssiioonn
- Arithmetic expansion allows the evaluation of an arithmetic expression
- and the substitution of the result. The format for arithmetic expan-
+ Arithmetic expansion allows the evaluation of an arithmetic expression
+ and the substitution of the result. The format for arithmetic expan-
sion is:
$$((((_e_x_p_r_e_s_s_i_o_n))))
- The _e_x_p_r_e_s_s_i_o_n is treated as if it were within double quotes, but a
- double quote inside the parentheses is not treated specially. All
+ The _e_x_p_r_e_s_s_i_o_n is treated as if it were within double quotes, but a
+ double quote inside the parentheses is not treated specially. All
tokens in the expression undergo parameter expansion, string expansion,
- command substitution, and quote removal. Arithmetic expansions may be
+ command substitution, and quote removal. Arithmetic expansions may be
nested.
- The evaluation is performed according to the rules listed below under
+ 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
indicating failure and no substitution occurs.
PPrroocceessss SSuubbssttiittuuttiioonn
- _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n is supported on systems that support named pipes
- (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files. It takes the form
- of <<((_l_i_s_t)) or >>((_l_i_s_t)). The process _l_i_s_t is run with its input or out-
+ _P_r_o_c_e_s_s _s_u_b_s_t_i_t_u_t_i_o_n is supported on systems that support named pipes
+ (_F_I_F_O_s) or the //ddeevv//ffdd method of naming open files. It takes the form
+ of <<((_l_i_s_t)) or >>((_l_i_s_t)). The process _l_i_s_t is run with its input or out-
put connected to a _F_I_F_O or some file in //ddeevv//ffdd. The name of this file
- 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 will pro-
- vide input for _l_i_s_t. If the <<((_l_i_s_t)) form is used, the file passed as
+ 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 will pro-
+ vide input for _l_i_s_t. If the <<((_l_i_s_t)) form is used, the file passed as
an argument should be read to obtain the output of _l_i_s_t.
- When available, process substitution is performed simultaneously with
- parameter and variable expansion, command substitution, and arithmetic
+ When available, process substitution is performed simultaneously with
+ parameter and variable expansion, command substitution, and arithmetic
expansion.
WWoorrdd SSpplliittttiinngg
- The shell scans the results of parameter expansion, command substitu-
- tion, and arithmetic expansion that did not occur within double quotes
+ The shell scans the results of parameter expansion, command substitu-
+ tion, and arithmetic expansion that did not occur within double quotes
for _w_o_r_d _s_p_l_i_t_t_i_n_g.
- The shell treats each character of IIFFSS as a delimiter, and splits the
+ The shell treats each character of IIFFSS as a delimiter, and splits the
results of the other expansions into words on these characters. If IIFFSS
- is unset, or its value is exactly <<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>, the default,
- then sequences of <<ssppaaccee>>, <<ttaabb>>, and <<nneewwlliinnee>> at the beginning and
- end of the results of the previous expansions are ignored, and any
- sequence of IIFFSS characters not at the beginning or end serves to
- delimit words. If IIFFSS has a value other than the default, then
+ is unset, or its value is exactly <<ssppaaccee>><<ttaabb>><<nneewwlliinnee>>, the default,
+ then sequences of <<ssppaaccee>>, <<ttaabb>>, and <<nneewwlliinnee>> at the beginning and
+ end of the results of the previous expansions are ignored, and any
+ sequence of IIFFSS characters not at the beginning or end serves to
+ delimit words. If IIFFSS has a value other than the default, then
sequences of the whitespace characters ssppaaccee and ttaabb are ignored at the
- beginning and end of the word, as long as the whitespace character is
- in the value of IIFFSS (an IIFFSS whitespace character). Any character in
- IIFFSS that is not IIFFSS whitespace, along with any adjacent IIFFSS whitespace
- characters, delimits a field. A sequence of IIFFSS whitespace characters
- is also treated as a delimiter. If the value of IIFFSS is null, no word
+ beginning and end of the word, as long as the whitespace character is
+ in the value of IIFFSS (an IIFFSS whitespace character). Any character in
+ IIFFSS that is not IIFFSS whitespace, along with any adjacent IIFFSS whitespace
+ characters, delimits a field. A sequence of IIFFSS whitespace characters
+ is also treated as a delimiter. If the value of IIFFSS is null, no word
splitting occurs.
- Explicit null arguments ("""" or '''') are retained. Unquoted implicit
+ Explicit null arguments ("""" or '''') are retained. Unquoted implicit
null arguments, resulting from the expansion of parameters that have no
- values, are removed. If a parameter with no value is expanded within
+ values, are removed. If a parameter with no value is expanded within
double quotes, a null argument results and is retained.
Note that if no expansion occurs, no splitting is performed.
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, then the word is regarded as a _p_a_t_t_e_r_n, and replaced with an
- alphabetically sorted list of file names matching the pattern. If no
- matching file names are found, and the shell option nnuullllgglloobb is dis-
- abled, 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, an error message is printed
- and the command is not executed. If the shell option nnooccaasseegglloobb is
- enabled, the match is performed without regard to the case of alpha-
- betic 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 explicitly, unless the shell option ddoottgglloobb is
- set. When matching a pathname, the slash character must always be
- matched explicitly. In other cases, the ````..'''' character is not
- treated specially. See the description of sshhoopptt below under SSHHEELLLL
- BBUUIILLTTIINN CCOOMMMMAANNDDSS for a description of the nnooccaasseegglloobb, nnuullllgglloobb, ffaaiill--
+ After word splitting, unless the --ff option has been set, bbaasshh scans
+ each word for the characters **, ??, and [[. If one of these characters
+ appears, then the word is regarded as a _p_a_t_t_e_r_n, and replaced with an
+ alphabetically sorted list of file names matching the pattern. If no
+ matching file names are found, and the shell option nnuullllgglloobb is dis-
+ abled, 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, an error message is printed
+ and the command is not executed. If the shell option nnooccaasseegglloobb is
+ enabled, the match is performed without regard to the case of alpha-
+ betic 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 explicitly, unless the shell option ddoottgglloobb is
+ set. When matching a pathname, the slash character must always be
+ matched explicitly. In other cases, the ````..'''' character is not
+ treated specially. See the description of sshhoopptt below under SSHHEELLLL
+ BBUUIILLTTIINN CCOOMMMMAANNDDSS for a description of the nnooccaasseegglloobb, nnuullllgglloobb, ffaaiill--
gglloobb, 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
+ 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. The file names ````..'''' and ````....'''' are always
- ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, setting GGLLOOBBIIGG--
- NNOORREE to a non-null value has the effect of enabling the ddoottgglloobb shell
+ ignored when GGLLOOBBIIGGNNOORREE is set and not null. However, setting GGLLOOBBIIGG--
+ NNOORREE to a non-null value has the effect of enabling the ddoottgglloobb shell
option, so all other file names beginning with a ````..'''' will match. To
- get the old behavior of ignoring file names beginning with a ````..'''',
- make ````..**'''' one of the patterns in GGLLOOBBIIGGNNOORREE. The ddoottgglloobb option is
+ get the old behavior of ignoring file names beginning with a ````..'''',
+ make ````..**'''' one of the patterns in GGLLOOBBIIGGNNOORREE. The ddoottgglloobb option is
disabled when GGLLOOBBIIGGNNOORREE is unset.
PPaatttteerrnn MMaattcchhiinngg
Any character that appears in a pattern, other than the special pattern
- characters described below, matches itself. The NUL character may not
- occur in a pattern. A backslash escapes the following character; the
- escaping backslash is discarded when matching. The special pattern
+ characters described below, matches itself. The NUL character may not
+ occur in a pattern. A backslash escapes the following character; the
+ escaping 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 gglloobb--
+ ** Matches any string, including the null string. When the gglloobb--
ssttaarr shell option is enabled, and ** is used in a filename expan-
- sion context, two adjacent **s used as a single pattern will
+ sion context, two adjacent **s used as a single pattern will
match all files and zero or more directories and subdirectories.
- If followed by a //, two adjacent **s will match only directories
+ If followed by a //, two adjacent **s will match only directories
and subdirectories.
?? Matches any single character.
- [[......]] Matches any one of the enclosed characters. A pair of charac-
+ [[......]] Matches any one of the enclosed characters. A pair of charac-
ters separated by a hyphen denotes a _r_a_n_g_e _e_x_p_r_e_s_s_i_o_n; any char-
- acter that sorts between those two characters, inclusive, using
- the current locale's collating sequence and character set, is
- matched. If the first character following the [[ is a !! or a ^^
- then any character not enclosed is matched. The sorting order
- of characters in range expressions is determined by the current
- locale and the value of the LLCC__CCOOLLLLAATTEE shell variable, if set.
- A -- may be matched by including it as the first or last charac-
+ acter that sorts between those two characters, inclusive, using
+ the current locale's collating sequence and character set, is
+ matched. If the first character following the [[ is a !! or a ^^
+ then any character not enclosed is matched. The sorting order
+ of characters in range expressions is determined by the current
+ locale and the value of the LLCC__CCOOLLLLAATTEE shell variable, if set.
+ A -- may be matched by including it as the first or last charac-
ter in the set. A ]] may be matched by including it as the first
character in the set.
- Within [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified using the
- syntax [[::_c_l_a_s_s::]], where _c_l_a_s_s is one of the following classes
+ Within [[ and ]], _c_h_a_r_a_c_t_e_r _c_l_a_s_s_e_s can be specified 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 class.
- The wwoorrdd character class matches letters, digits, and the char-
+ The wwoorrdd character class matches letters, digits, and the char-
acter _.
- Within [[ and ]], 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 characters with the same colla-
- tion weight (as defined by the current locale) as the character
+ Within [[ and ]], 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 characters with the same colla-
+ tion weight (as defined by the current locale) as the character
_c.
Within [[ and ]], the syntax [[.._s_y_m_b_o_l..]] matches the collating sym-
bol _s_y_m_b_o_l.
If the eexxttgglloobb shell option is enabled using the sshhoopptt builtin, several
- extended pattern matching operators are recognized. In the following
+ extended pattern matching operators are recognized. 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 fol-
lowing sub-patterns:
@@ -1704,48 +1705,48 @@ EEXXPPAANNSSIIOONN
QQuuoottee RReemmoovvaall
After the preceding expansions, all unquoted occurrences of the charac-
- ters \\, '', and "" that did not result from one of the above expansions
+ ters \\, '', and "" that did not result from one of the above expansions
are removed.
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. Redirection may
- also be used to open and close files for the current shell execution
+ 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. Redirection may
+ also be used to open and close files for the current shell execution
environment. The following redirection operators may precede 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.
- In the following descriptions, if the file descriptor number is omit-
- ted, and the first character of the redirection operator is <<, the re-
- direction refers to the standard input (file descriptor 0). If the
- first character of the redirection operator is >>, the redirection
+ In the following descriptions, if the file descriptor number is omit-
+ ted, and the first character of the redirection operator is <<, the re-
+ direction 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 word following the redirection operator in the following descrip-
- tions, unless otherwise noted, is subjected to brace expansion, tilde
+ The word following the redirection operator in the following descrip-
+ tions, unless otherwise noted, is subjected to brace expansion, tilde
expansion, parameter expansion, command substitution, arithmetic expan-
- sion, quote removal, pathname expansion, and word splitting. If it
+ sion, quote removal, pathname expansion, and word splitting. If it
expands to more than one word, bbaasshh reports an error.
- Note that the order of redirections is significant. For example, the
+ Note that the order of redirections is significant. For example, the
command
ls >> dirlist 2>>&&1
- directs both standard output and standard error to the file _d_i_r_l_i_s_t,
+ 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
- error was duplicated as standard output before the standard output was
+ directs only the standard output to file _d_i_r_l_i_s_t, because the standard
+ error was duplicated as 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:
//ddeevv//ffdd//_f_d
- If _f_d is a valid integer, file descriptor _f_d is dupli-
+ If _f_d is a valid integer, file descriptor _f_d is dupli-
cated.
//ddeevv//ssttddiinn
File descriptor 0 is duplicated.
@@ -1755,22 +1756,22 @@ RREEDDIIRREECCTTIIOONN
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 an integer port number or service name, bbaasshh attempts
+ is an integer port number or service name, bbaasshh attempts
to open a TCP connection to the corresponding 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 an integer port number or service name, bbaasshh attempts
+ is an integer port number or service name, bbaasshh attempts
to open a UDP connection to the corresponding 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
- care, as they may conflict with file descriptors the shell uses inter-
+ Redirections using file descriptors greater than 9 should be used with
+ care, as they may conflict with file descriptors the shell uses inter-
nally.
RReeddiirreeccttiinngg IInnppuutt
Redirection of input causes the file whose name results from the expan-
- sion of _w_o_r_d to be opened for reading on file descriptor _n, or the
+ sion of _w_o_r_d to be opened for reading on file descriptor _n, or the
standard input (file descriptor 0) if _n is not specified.
The general format for redirecting input is:
@@ -1778,27 +1779,27 @@ RREEDDIIRREECCTTIIOONN
[_n]<<_w_o_r_d
RReeddiirreeccttiinngg OOuuttppuutt
- Redirection of output causes the file whose name results from the
+ Redirection of output causes the file whose name results from the
expansion of _w_o_r_d to be opened for writing on file descriptor _n, or the
standard output (file descriptor 1) if _n is not specified. If the file
- does not exist it is created; if it does exist it is truncated to zero
+ does not exist it is created; 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 has been enabled, the redirection will fail 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 >>, and the nnoocclloobbbbeerr option to the sseett
+ builtin has been enabled, the redirection will fail 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 command is not enabled, the re-
direction is attempted even if the file named by _w_o_r_d exists.
AAppppeennddiinngg RReeddiirreecctteedd OOuuttppuutt
- Redirection of output in this fashion causes the file whose name
- results from the expansion of _w_o_r_d to be opened for appending on file
- descriptor _n, or the standard output (file descriptor 1) if _n is not
+ Redirection of output in this fashion causes the file whose name
+ results from the expansion of _w_o_r_d to be opened for appending on file
+ descriptor _n, or the standard output (file descriptor 1) if _n is not
specified. If the file does not exist it is created.
The general format for appending output is:
@@ -1807,11 +1808,11 @@ RREEDDIIRREECCTTIIOONN
RReeddiirreeccttiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr
- This construct allows both the standard output (file descriptor 1) and
- the standard error output (file descriptor 2) to be redirected to the
+ This construct allows both the standard output (file descriptor 1) and
+ the standard error output (file descriptor 2) to be redirected to the
file whose name is the expansion of _w_o_r_d.
- There are two formats for redirecting standard output and standard
+ There are two formats for redirecting standard output and standard
error:
&&>>_w_o_r_d
@@ -1825,8 +1826,8 @@ RREEDDIIRREECCTTIIOONN
AAppppeennddiinngg SSttaannddaarrdd OOuuttppuutt aanndd SSttaannddaarrdd EErrrroorr
- This construct allows both the standard output (file descriptor 1) and
- the standard error output (file descriptor 2) to be appended to the
+ This construct allows both the standard output (file descriptor 1) and
+ the standard error output (file descriptor 2) to be appended to the
file whose name is the expansion of _w_o_r_d.
The format for appending standard output and standard error is:
@@ -1838,9 +1839,9 @@ RREEDDIIRREECCTTIIOONN
>>>>_w_o_r_d 2>>&&1
HHeerree DDooccuummeennttss
- This type of redirection instructs the shell to read input from the
- current source until a line containing only _w_o_r_d (with no trailing
- blanks) is seen. All of the lines read up to that point are then used
+ This type of redirection instructs the shell to read input from the
+ current source until a line containing only _w_o_r_d (with no trailing
+ blanks) is seen. All of the lines read up to that point are then used
as the standard input for a command.
The format of here-documents is:
@@ -1849,18 +1850,18 @@ RREEDDIIRREECCTTIIOONN
_h_e_r_e_-_d_o_c_u_m_e_n_t
_d_e_l_i_m_i_t_e_r
- No parameter expansion, command substitution, arithmetic expansion, or
+ No parameter expansion, command substitution, arithmetic expansion, or
pathname expansion is performed on _w_o_r_d. If any characters in _w_o_r_d are
- 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, all
- lines of the here-document are subjected to parameter expansion, com-
- mand substitution, and arithmetic expansion. In the latter case, the
- character sequence \\<<nneewwlliinnee>> is ignored, and \\ must be used to quote
+ 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, all
+ lines of the here-document are subjected to parameter expansion, com-
+ mand substitution, and arithmetic expansion. In the latter case, the
+ character sequence \\<<nneewwlliinnee>> is ignored, and \\ must be used to quote
the characters \\, $$, and ``.
If the redirection operator is <<<<--, then all leading tab characters are
- stripped 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
+ stripped 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.
HHeerree SSttrriinnggss
@@ -1876,20 +1877,20 @@ RREEDDIIRREECCTTIIOONN
[_n]<<&&_w_o_r_d
is used to duplicate input file descriptors. If _w_o_r_d expands to one or
- more digits, the file descriptor denoted by _n is made to be a copy of
- that file descriptor. If the digits in _w_o_r_d do not specify a file
- descriptor open for input, a redirection error occurs. If _w_o_r_d evalu-
- ates to --, file descriptor _n is closed. If _n is not specified, the
+ more digits, the file descriptor denoted by _n is made to be a copy of
+ that file descriptor. If the digits in _w_o_r_d do not specify a file
+ descriptor open for input, a redirection error occurs. If _w_o_r_d evalu-
+ ates to --, file descriptor _n is closed. If _n is not specified, the
standard input (file descriptor 0) is used.
The operator
[_n]>>&&_w_o_r_d
- is used similarly to duplicate output file descriptors. If _n is not
- specified, the standard output (file descriptor 1) is used. If the
- digits in _w_o_r_d do not specify a file descriptor open for output, a re-
- direction error occurs. As a special case, if _n is omitted, and _w_o_r_d
+ is used similarly to duplicate output file descriptors. If _n is not
+ specified, the standard output (file descriptor 1) is used. If the
+ digits in _w_o_r_d do not specify a file descriptor open for output, a re-
+ direction error occurs. As a special case, if _n is omitted, and _w_o_r_d
does not expand to one or more digits, the standard output and standard
error are redirected as described previously.
@@ -1898,7 +1899,7 @@ RREEDDIIRREECCTTIIOONN
[_n]<<&&_d_i_g_i_t--
- moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
+ moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
input (file descriptor 0) if _n is not specified. _d_i_g_i_t is closed after
being duplicated to _n.
@@ -1906,7 +1907,7 @@ RREEDDIIRREECCTTIIOONN
[_n]>>&&_d_i_g_i_t--
- moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
+ moves the file descriptor _d_i_g_i_t to file descriptor _n, or the standard
output (file descriptor 1) if _n is not specified.
OOppeenniinngg FFiillee DDeessccrriippttoorrss ffoorr RReeaaddiinngg aanndd WWrriittiinngg
@@ -1914,108 +1915,108 @@ RREEDDIIRREECCTTIIOONN
[_n]<<>>_w_o_r_d
- causes the file whose name is the expansion of _w_o_r_d to be opened for
- both reading and writing on file descriptor _n, or on file descriptor 0
+ causes the file whose name is the expansion of _w_o_r_d to be opened for
+ both reading and writing on file descriptor _n, or on file descriptor 0
if _n is not specified. 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 when it is used as
- the first word of a simple command. The shell maintains a list of
- aliases that may be set and unset with the aalliiaass and uunnaalliiaass builtin
- commands (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The first word of each
- simple command, if unquoted, is checked to see if it has an alias. If
- so, that word is replaced by the text of the alias. The characters //,
- $$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s or quoting characters
+ _A_l_i_a_s_e_s allow a string to be substituted for a word when it is used as
+ the first word of a simple command. The shell maintains a list of
+ aliases that may be set and unset with the aalliiaass and uunnaalliiaass builtin
+ commands (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). The first word of each
+ simple command, if unquoted, is checked to see if it has an alias. If
+ so, that word is replaced by the text of the alias. The characters //,
+ $$, ``, and == and any of the shell _m_e_t_a_c_h_a_r_a_c_t_e_r_s or quoting characters
listed above may not appear in an alias name. The replacement text may
- contain any valid shell input, including shell metacharacters. 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, then the next command
+ contain any valid shell input, including shell metacharacters. 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, then the next command
word following the alias is also checked 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
- arguments are needed, a shell function should be used (see FFUUNNCCTTIIOONNSS
+ There is no mechanism for using arguments in the replacement text. If
+ arguments are needed, a shell function should be used (see FFUUNNCCTTIIOONNSS
below).
- Aliases are not expanded when the shell is not interactive, unless the
- eexxppaanndd__aalliiaasseess shell option is set using sshhoopptt (see the description of
+ Aliases are not expanded when the shell is not interactive, unless the
+ eexxppaanndd__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
- confusing. BBaasshh always reads at least one complete line of input
- before executing any of the commands on that line. Aliases are
- expanded when a command is read, not when it is executed. Therefore,
- an alias definition appearing on the same line as another command does
- not take effect until the next line of input is read. The commands
+ The rules concerning the definition and use of aliases are somewhat
+ confusing. BBaasshh always reads at least one complete line of input
+ before executing any of the commands on that line. Aliases are
+ expanded when a command is read, not when it is executed. Therefore,
+ an alias definition appearing on the same line as another command does
+ not take effect until the next line of input is read. The commands
following the alias definition on that line are not affected by the new
- alias. This behavior is also an issue when functions are executed.
- Aliases are expanded when a function definition is read, not when the
- function is executed, because a function definition is itself a com-
+ alias. This behavior is also an issue when functions are executed.
+ Aliases are expanded when a function definition is read, not when the
+ function is executed, because a function definition is itself a com-
pound command. As a consequence, aliases defined in a function are not
- available until after that function is executed. To be safe, always
- put alias definitions on a separate line, and do not use aalliiaass in com-
+ available until after that function is executed. To be safe, always
+ put alias definitions on a separate line, and do not use aalliiaass in com-
pound commands.
For almost every purpose, aliases are superseded by shell functions.
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 list of commands
+ 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 list of commands
associated with that function name is executed. Functions are executed
- in the context of the current shell; no new process is 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
+ in the context of the current shell; no new process is 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
positional parameters during its execution. The special parameter ## is
- updated to reflect the change. Special parameter 0 is unchanged. The
- first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func-
- tion while the function is executing. All other aspects of the shell
- execution environment are identical between a function and its caller
+ updated to reflect the change. Special parameter 0 is unchanged. The
+ first element of the FFUUNNCCNNAAMMEE variable is set to the name of the func-
+ tion while the function is executing. All other aspects of the shell
+ execution environment are identical between a function and its caller
with the exception that the DDEEBBUUGG and RREETTUURRNN traps (see the description
- of the ttrraapp builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) are not inher-
- ited unless the function has been given the ttrraaccee attribute (see the
- description of the ddeeccllaarree builtin below) or the --oo ffuunnccttrraaccee shell
- option has been enabled with the sseett builtin (in which case all func-
+ of the ttrraapp builtin under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) are not inher-
+ ited unless the function has been given the ttrraaccee attribute (see the
+ description of the ddeeccllaarree builtin below) or the --oo ffuunnccttrraaccee shell
+ option has been enabled with the sseett builtin (in which case all func-
tions inherit the DDEEBBUUGG and RREETTUURRNN traps).
- Variables local to the function may be declared with the llooccaall builtin
+ Variables local to the function may be declared with the llooccaall builtin
command. Ordinarily, variables and their values are shared between the
function and its caller.
- If the builtin command rreettuurrnn is executed in a function, the function
- completes and execution resumes with the next command after the func-
- tion call. Any command associated with the RREETTUURRNN trap is executed
+ If the builtin command rreettuurrnn is executed in a function, the function
+ completes and execution resumes with the next command after the func-
+ tion call. Any command associated with the RREETTUURRNN trap is executed
before execution resumes. When a function completes, the values of the
- positional parameters and the special parameter ## are restored to the
+ positional parameters and the special parameter ## are restored to the
values they had prior to the function's execution.
- Function names and definitions may be listed with the --ff option to the
+ Function names and definitions may be listed with the --ff option to the
ddeeccllaarree or ttyyppeesseett builtin commands. The --FF option to ddeeccllaarree or ttyyppee--
- sseett will list the function names only (and optionally the source file
- and line number, if the eexxttddeebbuugg shell option is enabled). Functions
- may be exported so that subshells automatically have them defined with
- the --ff option to the eexxppoorrtt builtin. A function definition may be
- deleted using the --ff option to the uunnsseett builtin. Note that shell
+ sseett will list the function names only (and optionally the source file
+ and line number, if the eexxttddeebbuugg shell option is enabled). Functions
+ may be exported so that subshells automatically have them defined with
+ the --ff option to the eexxppoorrtt builtin. A function definition may be
+ deleted using the --ff option to the uunnsseett builtin. Note that shell
functions and variables with the same name may result in multiple iden-
- tically-named entries in the environment passed to the shell's chil-
+ tically-named entries in the environment passed to the shell's chil-
dren. Care should be taken in cases where this may cause a problem.
- Functions may be recursive. No limit is imposed on the number of
+ Functions may be recursive. No limit is imposed on the number of
recursive calls.
AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN
- The shell allows arithmetic expressions to be evaluated, under certain
- circumstances (see the lleett and ddeeccllaarree builtin commands and AArriitthhmmeettiicc
- EExxppaannssiioonn). Evaluation is done in fixed-width integers with no check
- for overflow, though division by 0 is trapped and flagged as an error.
- 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
+ The shell allows arithmetic expressions to be evaluated, under certain
+ circumstances (see the lleett and ddeeccllaarree builtin commands and AArriitthhmmeettiicc
+ EExxppaannssiioonn). Evaluation is done in fixed-width integers with no check
+ for overflow, though division by 0 is trapped and flagged as an error.
+ 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 decreasing precedence.
_i_d++++ _i_d----
@@ -2043,39 +2044,39 @@ AARRIITTHHMMEETTIICC EEVVAALLUUAATTIIOONN
_e_x_p_r_1 ,, _e_x_p_r_2
comma
- Shell variables are allowed as operands; parameter expansion is per-
+ Shell variables are allowed as operands; parameter expansion is per-
formed before the expression is evaluated. Within an expression, shell
- variables may also be referenced by name without using the parameter
- expansion syntax. A shell variable that is null or unset evaluates to
+ variables may also be referenced by name without using the parameter
+ expansion syntax. A shell variable that is null or unset evaluates to
0 when referenced by name without using the parameter expansion syntax.
- 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
+ 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 shell variable need not have its integer attribute turned on
+ to 0. A shell variable need not have its integer attribute turned on
to be used in an expression.
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 _b_a_s_e is a decimal number between 2 and 64 representing
+ 0x or 0X denotes hexadecimal. Otherwise, numbers take the form
+ [_b_a_s_e_#]n, where _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 omit-
- ted, then base 10 is used. The digits greater than 9 are represented
- by the lowercase letters, the uppercase letters, @, and _, in that
- order. If _b_a_s_e is less than or equal to 36, lowercase and uppercase
+ ted, then base 10 is used. The digits greater than 9 are represented
+ by the lowercase 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 interchangeably to represent numbers between 10 and
35.
- Operators are evaluated in order of precedence. Sub-expressions in
- parentheses are evaluated first and may override the precedence rules
+ Operators are evaluated in order of precedence. Sub-expressions in
+ parentheses 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. Expressions are formed from the following
- unary or binary primaries. If any _f_i_l_e argument to one of the pri-
+ Conditional expressions are used by the [[[[ compound command and the
+ tteesstt and [[ builtin commands to test file attributes and perform string
+ and arithmetic comparisons. Expressions are formed from the following
+ unary or binary primaries. If any _f_i_l_e argument to one of the pri-
maries is of the form _/_d_e_v_/_f_d_/_n, then file descriptor _n is checked. 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, file descriptor 0, 1, or 2, respectively,
+ 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, file descriptor 0, 1, or 2, respectively,
is checked.
Unless otherwise specified, primaries that operate on files follow sym-
@@ -2122,20 +2123,20 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
--SS _f_i_l_e
True if _f_i_l_e exists and is a socket.
--NN _f_i_l_e
- True if _f_i_l_e exists and has been modified since it was last
+ True if _f_i_l_e exists and has been modified since it was last
read.
_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
+ 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
+ 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.
_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 num-
+ True if _f_i_l_e_1 and _f_i_l_e_2 refer to the same device and inode num-
bers.
--oo _o_p_t_n_a_m_e
- True if shell option _o_p_t_n_a_m_e is enabled. See the list of
- options under the description of the --oo option to the sseett
+ True if shell option _o_p_t_n_a_m_e is enabled. See the list of
+ options under the description of the --oo option to the sseett
builtin below.
--zz _s_t_r_i_n_g
True if the length of _s_t_r_i_n_g is zero.
@@ -2151,115 +2152,115 @@ CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS
True if the strings are not equal.
_s_t_r_i_n_g_1 << _s_t_r_i_n_g_2
- True if _s_t_r_i_n_g_1 sorts before _s_t_r_i_n_g_2 lexicographically in the
+ True if _s_t_r_i_n_g_1 sorts before _s_t_r_i_n_g_2 lexicographically in the
current locale.
_s_t_r_i_n_g_1 >> _s_t_r_i_n_g_2
- True if _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographically in the
+ True if _s_t_r_i_n_g_1 sorts after _s_t_r_i_n_g_2 lexicographically in the
current locale.
_a_r_g_1 OOPP _a_r_g_2
- OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic
- binary 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
+ OOPP is one of --eeqq, --nnee, --lltt, --llee, --ggtt, or --ggee. These arithmetic
+ binary 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.
SSIIMMPPLLEE CCOOMMMMAANNDD EEXXPPAANNSSIIOONN
- When a simple command is executed, the shell performs the following
+ When a simple command is executed, the shell performs the following
expansions, assignments, and redirections, from left to right.
- 1. The words that the parser has marked as variable assignments
- (those preceding the command name) and redirections are saved
+ 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
- expanded. If any words remain after expansion, the first word
- is taken to be the name of the command and the remaining words
+ 2. The words that are not variable assignments or redirections are
+ expanded. 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
expansion, parameter expansion, command substitution, arithmetic
- expansion, and quote removal before being assigned to the vari-
+ expansion, and quote removal before being assigned to the vari-
able.
If no command name results, the variable assignments affect the current
- shell environment. Otherwise, the variables are added to the environ-
- ment 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
- readonly variable, an error occurs, and the command exits with a non-
+ shell environment. Otherwise, the variables are added to the environ-
+ ment 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
+ readonly variable, an error occurs, and the command exits with a non-
zero status.
- If no command name results, redirections are performed, but do not
- affect the current shell environment. A redirection error causes the
+ 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
- described below. Otherwise, the command exits. If one of the expan-
- sions contained a command substitution, the exit status of the command
- is the exit status of the last command substitution performed. If
+ If there is a command name left after expansion, execution proceeds as
+ described below. Otherwise, the command exits. If one of the expan-
+ sions 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 status of
zero.
CCOOMMMMAANNDD EEXXEECCUUTTIIOONN
- After a command has been split into words, if it results in a simple
- command and an optional list of arguments, the following actions are
+ After a command has been split into words, if it results in a simple
+ command and an optional list of arguments, the following actions are
taken.
- 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
+ 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 con-
- taining 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). A full search of the directories in PPAATTHH is
- performed only if the command is not found in the hash table. If the
+ 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 con-
+ taining 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). A full search of the directories in PPAATTHH is
+ performed 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
- with the original command and the original command's arguments as its
- arguments, and the function's exit status becomes the exit status of
- the shell. If that function is not defined, the shell prints an error
+ with the original command and the original command's arguments as its
+ arguments, and the function's exit status becomes the exit status of
+ the 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
+ If the search is successful, or if the command name contains one or
more slashes, the shell executes the named program in a separate execu-
tion environment. Argument 0 is set to the name given, and the remain-
ing 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. A subshell is spawned to execute it.
- 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
+ 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. A subshell is spawned to execute it.
+ 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 CCOOMMMMAANNDDSS) 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
+ 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 exe-
cutable 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
+ 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 follow-
+ 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 follow-
ing:
- +o open files inherited by the shell at invocation, as modified by
+ +o open files inherited by the shell at invocation, as modified by
redirections supplied to the eexxeecc builtin
- +o the current working directory as set by ccdd, ppuusshhdd, or ppooppdd, or
+ +o the current working directory as set by ccdd, ppuusshhdd, or ppooppdd, or
inherited by the shell at invocation
- +o the file creation mode mask as set by uummaasskk or inherited from
+ +o the file creation mode mask as set by uummaasskk or inherited from
the shell's parent
+o current traps set by ttrraapp
@@ -2267,235 +2268,235 @@ CCOOMMMMAANNDD EEXXEECCUUTTIIOONN EENNVVIIRROONNMMEENN
+o shell parameters that are set by variable assignment or with sseett
or inherited from the shell's parent in the environment
- +o shell functions defined during execution or inherited from the
+ +o shell functions defined during execution or inherited from the
shell's parent in the environment
- +o options enabled at invocation (either by default or with com-
+ +o options enabled at invocation (either by default or with com-
mand-line arguments) or by sseett
+o options enabled by sshhoopptt
+o shell aliases defined with aalliiaass
- +o various process IDs, including those of background jobs, the
+ +o 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
- executed, it is invoked in a separate execution environment that con-
- sists of the following. Unless otherwise noted, the values are inher-
+ When a simple command other than a builtin or shell function is to be
+ executed, it is invoked in a separate execution environment that con-
+ sists of the following. Unless otherwise noted, the values are inher-
ited from the shell.
- +o the shell's open files, plus any modifications and additions
+ +o the shell's open files, plus any modifications and additions
specified by redirections to the command
+o the current working directory
+o the file creation mode mask
- +o shell variables and functions marked for export, along with
+ +o shell variables and functions marked for export, along with
variables exported for the command, passed in the environment
+o 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
+ A command invoked in this separate environment cannot affect the
shell's execution environment.
- Command substitution, commands grouped with parentheses, and asynchro-
+ Command substitution, commands grouped with parentheses, and asynchro-
nous commands are invoked in a subshell environment that is a duplicate
- of the shell environment, except that traps caught by the shell are
+ of the shell environment, except that traps caught by the shell are
reset to the values that the shell inherited from its parent at invoca-
tion. Builtin commands that are invoked as part of a pipeline are also
executed in a subshell environment. Changes made to the subshell envi-
ronment cannot affect the shell's execution environment.
- 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.
- Otherwise, the invoked command inherits the file descriptors of the
+ 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.
+ 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
+ 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
+ The shell provides several ways to manipulate the environment. On
invocation, 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 pro-
- cesses. Executed commands inherit the environment. The eexxppoorrtt and
- ddeeccllaarree --xx commands allow parameters and functions to be added to and
+ for each name found, automatically marking it for _e_x_p_o_r_t to child pro-
+ cesses. Executed commands inherit the environment. The eexxppoorrtt and
+ ddeeccllaarree --xx commands allow parameters and functions to be added to and
deleted from the environment. If the value of a parameter in the envi-
- ronment is modified, the new value 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 modi-
- fied in the shell, less any pairs removed by the uunnsseett command, plus
+ ronment is modified, the new value 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 modi-
+ fied in the shell, less any pairs removed by the uunnsseett command, plus
any additions via the eexxppoorrtt and ddeeccllaarree --xx commands.
- The environment for any _s_i_m_p_l_e _c_o_m_m_a_n_d or function may be augmented
- temporarily by prefixing it with parameter assignments, as described
+ The environment for any _s_i_m_p_l_e _c_o_m_m_a_n_d or function may be augmented
+ temporarily by prefixing it with parameter assignments, as described
above in PPAARRAAMMEETTEERRSS. These assignment statements affect only the envi-
ronment seen by that command.
- If the --kk option is set (see the sseett builtin command below), then _a_l_l
- parameter assignments are placed in the environment for a command, not
+ If the --kk option is set (see the sseett builtin command below), then _a_l_l
+ parameter 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 file name of the command and passed to that command in its envi-
+ When bbaasshh invokes an external command, the variable __ is set to the
+ full file name of the command and passed to that command in its envi-
ronment.
EEXXIITT SSTTAATTUUSS
- The exit status of an executed command is the value returned by the
+ 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
+ 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
+ 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. An exit status of zero indicates success. A non-zero
- exit status indicates failure. When a command terminates on a fatal
+ has succeeded. 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,
+ 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-zero (_f_a_l_s_e) if an error occurs while they execute. All builtins
+ 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.
- 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
+ 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
+ When bbaasshh is interactive, in the absence of any traps, it ignores
SSIIGGTTEERRMM (so that kkiillll 00 does not kill an interactive shell), and SSIIGGIINNTT
- is caught and handled (so that the wwaaiitt builtin is interruptible). In
- all cases, bbaasshh ignores SSIIGGQQUUIITT. If job control is in effect, bbaasshh
+ is caught and handled (so that the wwaaiitt builtin is interruptible). In
+ all cases, bbaasshh ignores SSIIGGQQUUIITT. If job control is in effect, bbaasshh
ignores SSIIGGTTTTIINN, SSIIGGTTTTOOUU, and SSIIGGTTSSTTPP.
Non-builtin commands run by bbaasshh have signal handlers set to the values
- inherited by the shell from its parent. 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 command substi-
+ inherited by the shell from its parent. 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 command substi-
tution ignore the keyboard-generated job control signals SSIIGGTTTTIINN, SSIIGGTT--
TTOOUU, 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
+ The shell exits by default upon receipt of a SSIIGGHHUUPP. Before exiting,
+ an interactive shell resends the SSIIGGHHUUPP to all jobs, running or
stopped. Stopped jobs are sent SSIIGGCCOONNTT to ensure that they receive the
- SSIIGGHHUUPP. To prevent the shell from sending the signal to a particular
- job, it should be removed from the jobs table with the ddiissoowwnn builtin
- (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or marked to not receive SSIIGGHHUUPP
+ SSIIGGHHUUPP. To prevent the shell from sending the signal to a particular
+ job, it should be removed from the jobs table with the ddiissoowwnn builtin
+ (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) or marked to not receive SSIIGGHHUUPP
using ddiissoowwnn --hh.
- If the hhuuppoonneexxiitt shell option has been set with sshhoopptt, bbaasshh sends a
+ If the hhuuppoonneexxiitt shell option has been set with 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
+ If bbaasshh is waiting for a command to complete and receives a signal for
which a trap has been set, the trap will not be executed until the com-
- mand completes. When bbaasshh is waiting for an asynchronous command via
- the wwaaiitt builtin, the reception of a signal for which a trap has been
+ mand completes. When bbaasshh is waiting for an asynchronous command via
+ the wwaaiitt builtin, the reception of a signal for which a trap has been
set will cause the wwaaiitt builtin to return immediately with an exit sta-
tus greater than 128, immediately after which the trap is executed.
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
+ _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
execution 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
+ point. A user typically employs this facility via an interactive
interface supplied jointly by the system's terminal driver and bbaasshh.
- The shell associates a _j_o_b with each pipeline. It keeps a table of
- currently executing jobs, which may be listed with the jjoobbss command.
- When bbaasshh starts a job asynchronously (in the _b_a_c_k_g_r_o_u_n_d), it prints a
+ The shell associates a _j_o_b with each pipeline. It keeps a table of
+ currently executing jobs, which may be listed with the jjoobbss command.
+ 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
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
+ 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,
+ To facilitate the implementation of the user interface to job control,
the operating system maintains the notion 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. Members of this process group (processes whose process group
ID is equal to the current terminal process group ID) receive keyboard-
- generated signals such as SSIIGGIINNTT. These processes are said to be in
- the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID
+ generated signals such as SSIIGGIINNTT. These processes are said to be in
+ the _f_o_r_e_g_r_o_u_n_d. _B_a_c_k_g_r_o_u_n_d processes are those whose process group ID
differs from the terminal's; such processes are immune to keyboard-gen-
- erated signals. Only foreground processes are allowed to read from or
+ erated signals. Only foreground processes are allowed to read from or
write to the terminal. Background processes which attempt to read from
(write to) the terminal are sent a SSIIGGTTTTIINN ((SSIIGGTTTTOOUU)) signal by the ter-
minal driver, which, unless caught, suspends the process.
- If the operating system on which bbaasshh is running supports job control,
+ 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 (typ-
ically ^^ZZ, Control-Z) while a process is running causes that process to
- be stopped and returns control 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 to be stopped
- when it attempts to read input from the terminal, and control to be
- returned to bbaasshh. The user may then manipulate the state of this job,
- using the bbgg command to continue it in the background, the ffgg command
+ be stopped and returns control 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 to be stopped
+ when it attempts to read input from the terminal, and control to be
+ returned to bbaasshh. The user may then manipulate 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. A ^^ZZ
takes effect immediately, and has the additional side effect of causing
pending output and typeahead to be discarded.
There are a number of ways to refer to a job in the shell. The charac-
- ter %% introduces a job name. 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 exam-
- ple, %%ccee refers to a stopped ccee job. If a prefix matches more than one
- job, bbaasshh reports an error. Using %%??ccee, on the other hand, refers to
- any job containing the string ccee in its command line. If the 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, which is the last
- job stopped while it was in the foreground or started in the back-
- ground. The _p_r_e_v_i_o_u_s _j_o_b may be referenced using %%--. If there is only
- a single job, %%++ and %%-- can both be used to refer to that job. In out-
- put pertaining to jobs (e.g., the output of the jjoobbss command), the cur-
- rent job is always flagged with a ++, and the previous job with a --. A
- single % (with no accompanying job specification) also refers to the
- current job.
-
- Simply naming a job can be used to bring it into the foreground: %%11 is
- a synonym for ````ffgg %%11'''', bringing job 1 from the background into the
- foreground. Similarly, ````%%11 &&'''' resumes job 1 in the background,
+ ter %% introduces a job specification (_j_o_b_s_p_e_c). 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 stopped ccee job. If a prefix
+ matches more than one job, bbaasshh reports an error. Using %%??ccee, on the
+ other hand, refers to any job containing the string ccee in its command
+ line. If the 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, which is the last job stopped while it was in the foreground
+ or started in the background. The _p_r_e_v_i_o_u_s _j_o_b may be referenced using
+ %%--. 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 flagged with a ++, and the pre-
+ vious job with a --. A single % (with no accompanying job specifica-
+ tion) also refers to the current job.
+
+ Simply naming a job can be used to bring it into the foreground: %%11 is
+ a synonym for ````ffgg %%11'''', bringing job 1 from the background into the
+ foreground. Similarly, ````%%11 &&'''' resumes job 1 in the background,
equivalent to ````bbgg %%11''''.
- The shell learns immediately whenever a job changes state. Normally,
+ The shell learns immediately whenever a job changes state. Normally,
bbaasshh waits until it is about to print a prompt before reporting changes
- in a job's status so as to not interrupt any other output. If the --bb
+ in a job's status so as to not interrupt any other output. If the --bb
option to the sseett builtin command is enabled, bbaasshh reports such changes
- immediately. Any trap on SSIIGGCCHHLLDD is executed for each child that
+ immediately. Any trap on SSIIGGCCHHLLDD is executed for each child that
exits.
- If an attempt to exit bbaasshh is made while jobs are stopped (or, if the
- cchheecckkjjoobbss shell option has been enabled using the sshhoopptt builtin, run-
+ If an attempt to exit bbaasshh is made while jobs are stopped (or, if the
+ cchheecckkjjoobbss shell option has been enabled using the sshhoopptt builtin, run-
ning), 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 a second attempt to exit is
- made without an intervening command, the shell does not print another
+ is enabled, lists the jobs and their statuses. The jjoobbss command may
+ then be used to inspect their status. If a second attempt to exit is
+ made without an intervening command, the shell does not print another
warning, and any stopped jobs are terminated.
PPRROOMMPPTTIINNGG
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 allows these prompt
- strings to be customized by inserting a number of backslash-escaped
+ it is ready to read a command, and the secondary prompt PPSS22 when it
+ needs more input to complete a command. BBaasshh allows these prompt
+ strings 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
+ \\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
- inserted into the prompt string; an empty _f_o_r_m_a_t results
+ the _f_o_r_m_a_t is passed to _s_t_r_f_t_i_m_e(3) and the result is
+ inserted into the prompt string; an empty _f_o_r_m_a_t results
in a locale-specific time representation. The braces are
required
\\ee an ASCII escape character (033)
@@ -2505,7 +2506,7 @@ PPRROOMMPPTTIINNGG
\\ll the basename of the shell's terminal device name
\\nn newline
\\rr carriage return
- \\ss the name of the shell, the basename of $$00 (the portion
+ \\ss the name of the shell, the basename of $$00 (the portion
following 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
@@ -2514,7 +2515,7 @@ PPRROOMMPPTTIINNGG
\\uu the username of the current user
\\vv the version of bbaasshh (e.g., 2.00)
\\VV the release of bbaasshh, version + patch level (e.g., 2.00.0)
- \\ww the current working directory, with $$HHOOMMEE abbreviated
+ \\ww the current working directory, with $$HHOOMMEE abbreviated
with a tilde (uses the $$PPRROOMMPPTT__DDIIRRTTRRIIMM variable)
\\WW the basename of the current working directory, with $$HHOOMMEE
abbreviated with a tilde
@@ -2523,28 +2524,31 @@ 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
+ \\[[ begin a sequence of non-printing characters, which could
+ be used to embed a terminal control sequence into the
prompt
\\]] end a sequence of non-printing characters
- The command number and the history number are usually different: the
- history number of a command is its position in the history list, which
- may include 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 expanded via parameter expansion, command substitu-
- tion, arithmetic expansion, and quote removal, subject to the value of
- the pprroommppttvvaarrss shell option (see the description of the sshhoopptt command
+ The command number and the history number are usually different: the
+ history number of a command is its position in the history list, which
+ may include 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 expanded via parameter expansion, command substitu-
+ tion, 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).
RREEAADDLLIINNEE
- This is the library that handles reading input when using an interac-
+ This is the library that handles reading input when using an interac-
tive shell, unless the ----nnooeeddiittiinngg option is given at shell invocation.
+ Line editing is also used when using the --ee option to the rreeaadd builtin.
By default, the line editing commands are similar to those of emacs. A
- vi-style line editing interface is also available. To turn off line
- editing after the shell is running, use the ++oo eemmaaccss or ++oo vvii options
- to the sseett builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below).
+ 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 running, use the ++oo eemmaaccss or ++oo vvii options to the
+ sseett builtin.
RReeaaddlliinnee NNoottaattiioonn
In this section, the emacs-style notation is used to denote keystrokes.
@@ -2911,6 +2915,12 @@ RREEAADDLLIINNEE
bbaacckkwwaarrdd--wwoorrdd ((MM--bb))
Move back to the start of the current or previous word. Words
are composed of alphanumeric characters (letters and digits).
+ sshheellll--ffoorrwwaarrdd--wwoorrdd
+ Move forward to the end of the next word. Words are delimited
+ by non-quoted shell metacharacters.
+ sshheellll--bbaacckkwwaarrdd--wwoorrdd
+ Move back to the start of the current or previous word. Words
+ are delimited by non-quoted shell metacharacters.
cclleeaarr--ssccrreeeenn ((CC--ll))
Clear the screen leaving the current line at the top of the
screen. With an argument, refresh the current line without
@@ -2998,7 +3008,7 @@ RREEAADDLLIINNEE
argument is ignored.
eeddiitt--aanndd--eexxeeccuuttee--ccoommmmaanndd ((CC--xxCC--ee))
Invoke an editor on the current command line, and execute the
- result as shell commands. BBaasshh attempts to invoke $$FFCCEEDDIITT,
+ result 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
@@ -3067,12 +3077,19 @@ RREEAADDLLIINNEE
bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt))
Kill the word behind point. Word boundaries are the same as
those used by bbaacckkwwaarrdd--wwoorrdd.
+ sshheellll--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 used by sshheellll--ffoorrwwaarrdd--wwoorrdd.
+ sshheellll--bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt))
+ 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 bound-
+ Kill the word behind point, using white space as a word bound-
ary. The killed text is saved on the kill-ring.
uunniixx--ffiilleennaammee--rruubboouutt
- Kill the word behind point, using white space and the slash
- character as the word boundaries. The killed text is saved on
+ Kill the word behind point, using white space and the slash
+ character as the word boundaries. The killed text is saved on
the kill-ring.
ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\))
Delete all spaces and tabs around point.
@@ -3081,61 +3098,61 @@ RREEAADDLLIINNEE
ccooppyy--rreeggiioonn--aass--kkiillll
Copy the text in the region to the kill buffer.
ccooppyy--bbaacckkwwaarrdd--wwoorrdd
- Copy the word before point to the kill buffer. The word bound-
+ Copy the word before point to the kill buffer. The word bound-
aries are the same as bbaacckkwwaarrdd--wwoorrdd.
ccooppyy--ffoorrwwaarrdd--wwoorrdd
- Copy the word following point to the kill buffer. The word
+ Copy the word following point to the kill buffer. The word
boundaries 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 follow-
+ Rotate the kill ring, and yank the new top. Only works follow-
ing yyaannkk or yyaannkk--ppoopp.
NNuummeerriicc AArrgguummeennttss
ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ......,, MM----))
- Add this digit to the argument already accumulating, or start a
+ 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
- followed by one or more digits, optionally with a leading minus
- sign, those digits define the argument. If the command is fol-
- lowed by digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the
- numeric argument, but is otherwise ignored. As a special case,
- if this command is immediately followed by a character that is
- neither a digit or minus sign, the argument count for the next
- command is multiplied by four. The argument count is initially
- one, so executing this function the first time makes the argu-
+ This is another way to specify an argument. If this command is
+ followed by one or more digits, optionally with a leading minus
+ sign, those digits define the argument. If the command is fol-
+ lowed by digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the
+ numeric argument, but is otherwise ignored. As a special case,
+ if this command is immediately followed by a character that is
+ neither a digit or minus sign, the argument count for the next
+ command is multiplied by four. The argument count is initially
+ one, so executing this function the first time makes the argu-
ment 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
+ Attempt to perform completion on the text before point. BBaasshh
attempts completion treating the text as a variable (if the text
- begins with $$), username (if the text begins with ~~), hostname
- (if the text begins with @@), or command (including aliases and
+ begins with $$), username (if the text begins with ~~), hostname
+ (if the text begins with @@), or command (including aliases and
functions) in turn. If none of these produces a match, filename
completion is attempted.
ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??))
List the possible completions of the text before point.
iinnsseerrtt--ccoommpplleettiioonnss ((MM--**))
- Insert all completions of the text before point that would have
+ Insert all completions of the text before point that would have
been generated by ppoossssiibbllee--ccoommpplleettiioonnss.
mmeennuu--ccoommpplleettee
- Similar to ccoommpplleettee, but replaces the word to be completed with
- a single match from the list of possible completions. Repeated
- execution of mmeennuu--ccoommpplleettee steps through the list of possible
- completions, inserting each match in turn. At the end of the
+ Similar to ccoommpplleettee, but replaces the word to be completed with
+ a single match from the list of possible completions. Repeated
+ execution of mmeennuu--ccoommpplleettee steps through the list of possible
+ completions, inserting each match in turn. At the end of the
list of completions, the bell is rung (subject to the setting of
bbeellll--ssttyyllee) and the original text is restored. An argument of _n
- moves _n positions forward in the list of matches; a negative
- argument may be used to move backward through the list. This
- command is intended to be bound to TTAABB, but is unbound by
+ moves _n positions forward in the list of matches; a negative
+ argument may be used to move backward through the list. This
+ command is intended to be bound to TTAABB, but 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). If at the end of the
+ Deletes the character under the cursor if not at the beginning
+ or end of the line (like ddeelleettee--cchhaarr). If at the end of the
line, behaves identically to ppoossssiibbllee--ccoommpplleettiioonnss. This command
is unbound by default.
ccoommpplleettee--ffiilleennaammee ((MM--//))
@@ -3144,201 +3161,201 @@ RREEAADDLLIINNEE
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
+ Attempt completion on the text before point, treating it as a
username.
ppoossssiibbllee--uusseerrnnaammee--ccoommpplleettiioonnss ((CC--xx ~~))
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
+ 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 as a shell variable.
ccoommpplleettee--hhoossttnnaammee ((MM--@@))
- Attempt completion on the text before point, treating it as a
+ Attempt completion on the text before point, treating it as a
hostname.
ppoossssiibbllee--hhoossttnnaammee--ccoommpplleettiioonnss ((CC--xx @@))
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
- command name. Command completion attempts to match the text
- against aliases, reserved words, shell functions, shell
+ Attempt completion on the text before point, treating it as a
+ command name. Command completion attempts to match the text
+ against aliases, reserved words, shell functions, shell
builtins, and finally executable filenames, in that order.
ppoossssiibbllee--ccoommmmaanndd--ccoommpplleettiioonnss ((CC--xx !!))
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
- against lines from the history list for possible completion
+ Attempt completion on the text before point, comparing the text
+ against lines from the history list for possible completion
matches.
ddaabbbbrreevv--eexxppaanndd
- Attempt menu completion on the text before point, comparing the
+ Attempt menu completion on the text before point, comparing the
text against lines from the history list for possible completion
matches.
ccoommpplleettee--iinnttoo--bbrraacceess ((MM--{{))
Perform filename completion and insert the list of possible com-
- pletions enclosed within braces so the list is available to the
+ pletions enclosed within braces so the list is available to the
shell (see BBrraaccee EExxppaannssiioonn above).
KKeeyybbooaarrdd MMaaccrrooss
ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (())
- Begin saving the characters typed into the current keyboard
+ Begin saving the characters typed into the current keyboard
macro.
eenndd--kkbbdd--mmaaccrroo ((CC--xx ))))
Stop saving the characters typed into the current keyboard macro
and store the definition.
ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee))
- Re-execute the last keyboard macro defined, by making the char-
+ Re-execute the last keyboard macro defined, by making the char-
acters in the macro appear as if typed at the keyboard.
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
+ Read in the contents of the _i_n_p_u_t_r_c file, and incorporate any
bindings or variable assignments found there.
aabboorrtt ((CC--gg))
- Abort the current editing command and ring the terminal's bell
+ Abort the current editing command and ring the terminal's bell
(subject to the setting of bbeellll--ssttyyllee).
ddoo--uuppppeerrccaassee--vveerrssiioonn ((MM--aa,, MM--bb,, MM--_x,, ......))
- If the metafied character _x is lowercase, run the command that
+ If the metafied character _x is lowercase, run the command that
is bound to the corresponding uppercase character.
pprreeffiixx--mmeettaa ((EESSCC))
Metafy the next character typed. EESSCC ff is equivalent to MMeettaa--ff.
uunnddoo ((CC--__,, CC--xx CC--uu))
Incremental undo, separately remembered for each line.
rreevveerrtt--lliinnee ((MM--rr))
- Undo all changes made to this line. This is like executing the
- uunnddoo command enough times to return the line to its initial
+ Undo all changes made to this line. This is like executing the
+ uunnddoo command enough times to return the line to its initial
state.
ttiillddee--eexxppaanndd ((MM--&&))
Perform tilde expansion on the current word.
sseett--mmaarrkk ((CC--@@,, MM--<<ssppaaccee>>))
- Set the mark to the point. If a numeric argument is supplied,
+ Set the mark to the point. If a numeric argument is supplied,
the mark is set to that position.
eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx))
- Swap the point with the mark. The current cursor position is
- set to the saved position, and the old cursor position is saved
+ Swap the point with the mark. The current cursor position is
+ set to the saved position, and the old cursor position is saved
as the mark.
cchhaarraacctteerr--sseeaarrcchh ((CC--]]))
A character is read and point is moved to the next occurrence of
- that character. A negative count searches for previous occur-
+ that character. A negative count searches for previous occur-
rences.
cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]]))
- A character is read and point is moved to the previous occur-
- rence of that character. A negative count searches for subse-
+ A character is read and point is moved to the previous occur-
+ rence of that character. A negative count searches for subse-
quent occurrences.
iinnsseerrtt--ccoommmmeenntt ((MM--##))
- Without a numeric argument, the value of the readline ccoomm--
- mmeenntt--bbeeggiinn variable is inserted at the beginning of the current
+ Without a numeric argument, the value of the readline ccoomm--
+ mmeenntt--bbeeggiinn variable is inserted at the beginning of the current
line. If a numeric 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, the value is inserted, other-
+ toggle: if the characters at the beginning of the line do not
+ match the value of ccoommmmeenntt--bbeeggiinn, the value is inserted, other-
wise the characters in ccoommmmeenntt--bbeeggiinn are deleted from the begin-
- ning 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
+ ning 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.
gglloobb--ccoommpplleettee--wwoorrdd ((MM--gg))
- The word before point is treated as a pattern for pathname
- expansion, with an asterisk implicitly appended. This pattern
- is used to generate a list of matching file names for possible
+ The word before point is treated as a pattern for pathname
+ expansion, with an asterisk implicitly appended. This pattern
+ is used to generate a list of matching file names for possible
completions.
gglloobb--eexxppaanndd--wwoorrdd ((CC--xx **))
- The word before point is treated as a pattern for pathname
- expansion, and the list of matching file names is inserted,
- replacing the word. If a numeric argument is supplied, an
+ The word before point is treated as a pattern for pathname
+ expansion, and the list of matching file names is inserted,
+ replacing the word. If a numeric argument is supplied, an
asterisk is appended before pathname expansion.
gglloobb--lliisstt--eexxppaannssiioonnss ((CC--xx gg))
- The list of expansions that would have been generated by
- gglloobb--eexxppaanndd--wwoorrdd is displayed, and the line is redrawn. If a
- numeric argument is supplied, an asterisk is appended before
+ The list of expansions that would have been generated by
+ gglloobb--eexxppaanndd--wwoorrdd is displayed, and the line is redrawn. If a
+ numeric argument is supplied, an asterisk is appended before
pathname expansion.
dduummpp--ffuunnccttiioonnss
- Print all of the functions and their key bindings to the read-
+ Print all of the functions and their key bindings to the read-
line 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
+ put 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 readline variables and their values to
- the readline output stream. If a numeric argument is supplied,
- the output is formatted in such a way that it can be made part
+ the readline 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--mmaaccrrooss
- Print all of the readline key sequences bound to macros and the
- strings they output. If a numeric argument is supplied, the
+ Print all of the readline key sequences bound to macros and the
+ strings they output. 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.
ddiissppllaayy--sshheellll--vveerrssiioonn ((CC--xx CC--vv))
- Display version information about the current instance of bbaasshh.
+ Display version information about the current instance of bbaasshh.
PPrrooggrraammmmaabbllee CCoommpplleettiioonn
- When word completion is attempted for an argument to a command for
- which a completion specification (a _c_o_m_p_s_p_e_c) has been defined using
- the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the pro-
+ When word completion is attempted for an argument to a command for
+ which a completion specification (a _c_o_m_p_s_p_e_c) has been defined using
+ the ccoommpplleettee builtin (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the pro-
grammable completion facilities are invoked.
- First, the command name is identified. If a compspec has been defined
+ First, the command name is identified. 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 a full pathname, a
- compspec for the full pathname is searched for first. If no compspec
- is found for the full pathname, an attempt is made to find a compspec
+ completions for the word. If the command word is a full pathname, a
+ compspec for the full pathname is searched for first. If no compspec
+ is found for the full pathname, an attempt is made to find a compspec
for the portion following the final slash.
- Once a compspec has been found, it is used to generate the list of
- matching words. If a compspec is not found, the default bbaasshh comple-
+ Once a compspec has been found, it is used to generate the list of
+ matching words. If a compspec is not found, the default bbaasshh comple-
tion as described above under CCoommpplleettiinngg is performed.
- First, the actions specified by the compspec are used. Only matches
- which are prefixed by the word being completed are returned. When the
- --ff or --dd option is used for filename or directory name completion, the
+ First, the actions specified by the compspec are used. Only matches
+ which are prefixed by the word being completed are returned. When the
+ --ff or --dd option is used for filename or directory name completion, the
shell variable FFIIGGNNOORREE is used to filter the matches.
- Any completions specified by a filename expansion pattern to the --GG
+ Any completions specified by a filename expansion pattern to the --GG
option are generated next. The words generated by the pattern need not
- match the word being completed. The GGLLOOBBIIGGNNOORREE shell variable is not
+ match the word being completed. The GGLLOOBBIIGGNNOORREE shell variable is not
used to filter the matches, but the FFIIGGNNOORREE variable is used.
- Next, the string specified as the argument to the --WW option is consid-
- ered. The string is first split using the characters in the IIFFSS spe-
- cial variable as delimiters. Shell quoting is honored. Each word is
- then expanded using brace expansion, tilde expansion, parameter and
- variable expansion, command substitution, and arithmetic expansion, as
+ Next, the string specified as the argument to the --WW option is consid-
+ ered. The string is first split using the characters in the IIFFSS spe-
+ cial variable as delimiters. Shell quoting is honored. Each word is
+ then expanded using brace expansion, tilde expansion, parameter and
+ variable expansion, command substitution, 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 completed, and the matching words
become the possible completions.
- After these matches have been generated, any shell function or command
- specified with the --FF and --CC options is invoked. When the command or
+ After these matches have been generated, any shell function or command
+ specified with the --FF and --CC options is invoked. When the command or
function is invoked, the CCOOMMPP__LLIINNEE, CCOOMMPP__PPOOIINNTT, CCOOMMPP__KKEEYY, and CCOOMMPP__TTYYPPEE
variables are assigned values as described above under SShheellll VVaarriiaabblleess.
- If a shell function is being invoked, the CCOOMMPP__WWOORRDDSS and CCOOMMPP__CCWWOORRDD
- variables are also set. When the function or command is invoked, the
- first argument is the name of the command whose arguments are being
- completed, the second argument is the word being completed, and the
- third argument is the word preceding the word being completed on the
- current command line. No filtering of the generated completions
- against the word being completed is performed; the function or command
+ If a shell function is being invoked, the CCOOMMPP__WWOORRDDSS and CCOOMMPP__CCWWOORRDD
+ variables are also set. When the function or command is invoked, the
+ first argument is the name of the command whose arguments are being
+ completed, the second argument is the word being completed, and the
+ third argument is the word preceding the word being completed on the
+ current command line. No filtering of the generated completions
+ against the word being completed is performed; the function or command
has complete freedom in generating the matches.
- Any function specified with --FF is invoked first. The function may use
- any of the shell facilities, including the ccoommppggeenn builtin described
- below, to generate the matches. It must put the possible completions
+ Any function specified with --FF is invoked first. The function may use
+ any of the shell facilities, including the ccoommppggeenn builtin described
+ below, to generate the matches. It must put the possible completions
in the CCOOMMPPRREEPPLLYY array variable.
- Next, any command specified with the --CC option is invoked in an envi-
- ronment equivalent to command substitution. It should print a list of
- completions, one per line, to the standard output. Backslash may be
+ Next, any command specified with the --CC option is invoked in an envi-
+ ronment equivalent to command substitution. It should print a list of
+ completions, one per line, to the standard output. Backslash may be
used to escape a newline, if necessary.
- After all of the possible completions are generated, any filter speci-
- fied with the --XX option is applied to the list. The filter is a pat-
- tern 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 completion that matches the pattern will be removed from the list.
+ After all of the possible completions are generated, any filter speci-
+ fied with the --XX option is applied to the list. The filter is a pat-
+ tern 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 completion that matches the pattern will be removed from the list.
A leading !! negates the pattern; in this case any completion not match-
ing the pattern will be removed.
@@ -3346,136 +3363,136 @@ RREEAADDLLIINNEE
added to each member of the completion list, and the result is returned
to the readline completion code 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
+ If the previously-applied actions do not generate any matches, and the
+ --oo ddiirrnnaammeess option was supplied to ccoommpplleettee when the compspec was
defined, directory name completion is attempted.
- If the --oo pplluussddiirrss option was supplied to ccoommpplleettee when the compspec
+ If the --oo pplluussddiirrss option was supplied to ccoommpplleettee when the compspec
was defined, directory name completion is attempted and any matches are
added to the results of the other actions.
- By default, if a compspec is found, whatever it generates is returned
- to the completion code as the full set of possible completions. The
+ 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 are not attempted, and the readline default of
filename completion is disabled. If the --oo bbaasshhddeeffaauulltt option was sup-
- plied to ccoommpplleettee when the compspec was defined, the bbaasshh default com-
+ plied to ccoommpplleettee when the compspec was defined, the bbaasshh default com-
pletions are attempted if the compspec generates no matches. If the --oo
- ddeeffaauulltt option was supplied to ccoommpplleettee when the compspec was defined,
- readline's default completion will be performed if the compspec (and,
+ ddeeffaauulltt option was supplied to ccoommpplleettee when the compspec was defined,
+ readline's default completion will be performed if the compspec (and,
if attempted, the default bbaasshh completions) generate no matches.
- When a compspec indicates that directory name completion is desired,
- the programmable completion functions force readline to append a slash
- to completed names which are symbolic links to directories, subject to
- the value of the mmaarrkk--ddiirreeccttoorriieess readline variable, regardless of the
+ When a compspec indicates that directory name completion is desired,
+ the programmable completion functions force readline to append a slash
+ to completed names which are symbolic links to directories, subject to
+ the value of the mmaarrkk--ddiirreeccttoorriieess readline variable, regardless of the
setting of the mmaarrkk--ssyymmlliinnkkeedd--ddiirreeccttoorriieess readline variable.
HHIISSTTOORRYY
- When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell
+ When the --oo hhiissttoorryy option to the sseett builtin is enabled, the shell
provides 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
+ typed. The value of the HHIISSTTSSIIZZEE variable is used as the number of
commands to save in a history list. The text of the last HHIISSTTSSIIZZEE com-
- mands (default 500) is saved. 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
+ mands (default 500) is saved. 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 variables HHIISSTTIIGGNNOORREE and HHIISSTTCCOONNTTRROOLL.
On startup, the history is initialized from the file named by the vari-
- able HHIISSTTFFIILLEE (default _~_/_._b_a_s_h___h_i_s_t_o_r_y). The file named by the value
- of HHIISSTTFFIILLEE is truncated, if necessary, to contain no more than the
- number of lines specified by the value of HHIISSTTFFIILLEESSIIZZEE. When the his-
- tory file is read, lines beginning with the history comment character
- followed immediately by a digit are interpreted as timestamps for the
- preceding history line. These timestamps are optionally displayed
- depending on the value of the HHIISSTTTTIIMMEEFFOORRMMAATT variable. When an inter-
- active shell exits, the last $$HHIISSTTSSIIZZEE lines are copied from the his-
+ able HHIISSTTFFIILLEE (default _~_/_._b_a_s_h___h_i_s_t_o_r_y). The file named by the value
+ of HHIISSTTFFIILLEE is truncated, if necessary, to contain no more than the
+ number of lines specified by the value of HHIISSTTFFIILLEESSIIZZEE. When the his-
+ tory file is read, lines beginning with the history comment character
+ followed immediately by a digit are interpreted as timestamps for the
+ preceding history line. These timestamps are optionally displayed
+ depending on the value of the HHIISSTTTTIIMMEEFFOORRMMAATT variable. When an inter-
+ active shell exits, the last $$HHIISSTTSSIIZZEE lines are copied from the his-
tory list to $$HHIISSTTFFIILLEE. If the hhiissttaappppeenndd shell option is enabled (see
the description of sshhoopptt under SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below), the lines
- are appended to the history file, otherwise the history file is over-
- written. If HHIISSTTFFIILLEE is unset, or if the history file is unwritable,
- the history is not saved. If the variable is set, time stamps are
+ are appended to the history file, otherwise the history file is over-
+ written. If HHIISSTTFFIILLEE is unset, or if the history file is unwritable,
+ the history is not saved. If the variable is set, time stamps are
written to the history file, marked with the history comment character,
- so they may be preserved across shell sessions. This uses the history
- comment character to distinguish timestamps from other history lines.
- After saving the history, the history file is truncated to contain no
- more than HHIISSTTFFIILLEESSIIZZEE lines. If HHIISSTTFFIILLEESSIIZZEE is not set, no trunca-
+ so they may be preserved across shell sessions. This uses the history
+ comment character to distinguish timestamps from other history lines.
+ After saving the history, the history file is truncated to contain no
+ more than HHIISSTTFFIILLEESSIIZZEE lines. If HHIISSTTFFIILLEESSIIZZEE is not set, no trunca-
tion is performed.
- The builtin command ffcc (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) may be used
+ The builtin command ffcc (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below) may be used
to list or edit and re-execute a portion of the history list. The hhiiss--
- ttoorryy builtin may be used to display or modify the history list and
- manipulate the history file. When using command-line editing, search
- commands are available in each editing mode that provide access to the
+ ttoorryy builtin may be used to display or modify the history list and
+ manipulate the history file. When using command-line editing, search
+ commands are available in each editing mode that provide access to the
history list.
- The shell allows control over which commands are saved on the history
+ The shell allows control over which commands are saved on the history
list. The HHIISSTTCCOONNTTRROOLL and HHIISSTTIIGGNNOORREE variables may be set to cause the
shell to save only a subset of the commands entered. The ccmmddhhiisstt shell
- option, if enabled, causes the shell to attempt to save each line of a
- multi-line command in the same history entry, adding semicolons where
- necessary to preserve syntactic correctness. The lliitthhiisstt shell option
- causes the shell to save the command with embedded newlines instead of
+ option, if enabled, causes the shell to attempt to save each line of a
+ multi-line command in the same history entry, adding semicolons where
+ necessary to preserve syntactic correctness. The lliitthhiisstt shell option
+ causes the shell to save the command with embedded newlines instead of
semicolons. See the description of the sshhoopptt builtin below under SSHHEELLLL
BBUUIILLTTIINN CCOOMMMMAANNDDSS for information on setting and unsetting shell
options.
HHIISSTTOORRYY EEXXPPAANNSSIIOONN
- The shell supports a history expansion feature that is similar to the
- history expansion in ccsshh.. This section describes what syntax features
- are available. This feature is enabled by default for interactive
+ The shell supports a history expansion feature that is similar to the
+ history expansion in ccsshh.. This section describes what syntax features
+ are available. This feature is enabled by default for interactive
shells, and can be disabled using the ++HH option to the sseett builtin com-
mand (see SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS below). Non-interactive shells do not
perform history expansion by default.
History expansions introduce words from the history list into the input
- stream, making it easy to repeat commands, insert the arguments to a
+ stream, making it easy to repeat commands, insert the arguments to a
previous command into the current input line, or fix errors in previous
commands quickly.
- History expansion is performed immediately after a complete line is
- read, before the shell breaks it into words. It takes place in two
- parts. The first is to determine which line from the history list to
+ History expansion is performed immediately after a complete line is
+ read, before the shell breaks it into words. It takes place in two
+ parts. The first is to determine which line from the history list to
use during substitution. The second is to select portions of that line
for inclusion into the current one. The line selected from the history
- is the _e_v_e_n_t, and the portions of that line that are acted upon are
- _w_o_r_d_s. Various _m_o_d_i_f_i_e_r_s are available to manipulate the selected
+ is the _e_v_e_n_t, and the portions of that line that are acted upon are
+ _w_o_r_d_s. Various _m_o_d_i_f_i_e_r_s are available to manipulate the selected
words. The line is broken into words in the same fashion as when read-
- ing input, so that several _m_e_t_a_c_h_a_r_a_c_t_e_r-separated words surrounded by
- quotes are considered one word. History expansions are introduced by
- the appearance of the history expansion character, which is !! by
- default. Only backslash (\\) and single quotes can quote the history
+ ing input, so that several _m_e_t_a_c_h_a_r_a_c_t_e_r-separated words surrounded by
+ quotes are considered one word. History expansions are introduced by
+ the appearance of the history expansion character, which is !! by
+ default. Only backslash (\\) and single quotes can quote the history
expansion character.
- Several characters inhibit history expansion if found immediately fol-
- lowing the history expansion character, even if it is unquoted: space,
- tab, newline, carriage return, and ==. If the eexxttgglloobb shell option is
+ Several characters inhibit history expansion if found immediately fol-
+ lowing the history expansion character, even if it is unquoted: space,
+ tab, newline, carriage return, and ==. If the eexxttgglloobb shell option is
enabled, (( will also inhibit expansion.
- Several shell options settable with the sshhoopptt builtin may be used to
- tailor the behavior of history expansion. If the hhiissttvveerriiffyy shell
+ Several shell options settable with the sshhoopptt builtin may be used to
+ tailor the behavior of history expansion. If the hhiissttvveerriiffyy shell
option is enabled (see the description of the sshhoopptt builtin), and rreeaadd--
lliinnee is being used, history substitutions are not immediately passed to
- the shell parser. Instead, the expanded line is reloaded into the
+ the shell parser. Instead, the expanded line is reloaded into the
rreeaaddlliinnee editing buffer for further modification. If rreeaaddlliinnee is being
used, and the hhiissttrreeeeddiitt shell option is enabled, a failed history sub-
stitution will be reloaded into the rreeaaddlliinnee editing buffer for correc-
- tion. The --pp option to the hhiissttoorryy builtin command may be used to see
+ tion. The --pp option to the hhiissttoorryy builtin command may be used to see
what a history expansion will do before using it. The --ss option to the
- hhiissttoorryy builtin may be used to add commands to the end of the history
- list without actually executing them, so that they are available for
+ hhiissttoorryy builtin may be used to add commands to the end of the history
+ list without actually executing them, so that they are available for
subsequent recall.
- The shell allows control of the various characters used by the history
+ The shell allows control of the various characters used by the history
expansion mechanism (see the description of hhiissttcchhaarrss above under SShheellll
- VVaarriiaabblleess). The shell uses the history comment character to mark his-
+ VVaarriiaabblleess). The shell uses the history comment character to mark his-
tory timestamps when writing the history file.
EEvveenntt DDeessiiggnnaattoorrss
- An event designator is a reference to a command line entry in the his-
+ An event designator is a reference to a command line entry in the his-
tory list.
- !! Start a history substitution, except when followed by a bbllaannkk,
- newline, carriage return, = or ( (when the eexxttgglloobb shell option
+ !! Start a history substitution, except when followed by a bbllaannkk,
+ newline, carriage return, = or ( (when the eexxttgglloobb shell option
is enabled using the sshhoopptt builtin).
!!_n Refer to command line _n.
!!--_n Refer to the current command line minus _n.
@@ -3483,21 +3500,21 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN
!!_s_t_r_i_n_g
Refer to the most recent command starting with _s_t_r_i_n_g.
!!??_s_t_r_i_n_g[[??]]
- Refer to the most recent command containing _s_t_r_i_n_g. The trail-
+ Refer to the most recent command containing _s_t_r_i_n_g. The trail-
ing ?? may be omitted if _s_t_r_i_n_g is followed immediately by a new-
line.
^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^
- Quick substitution. Repeat the last command, replacing _s_t_r_i_n_g_1
+ Quick substitution. Repeat the last command, replacing _s_t_r_i_n_g_1
with _s_t_r_i_n_g_2. Equivalent to ``!!:s/_s_t_r_i_n_g_1/_s_t_r_i_n_g_2/'' (see MMoodd--
iiffiieerrss below).
!!## The entire command line typed so far.
WWoorrdd DDeessiiggnnaattoorrss
- Word designators are used to select desired words from the event. A ::
- separates the event specification from the word designator. It may be
- omitted if the word designator begins with a ^^, $$, **, --, or %%. Words
- are numbered from the beginning of the line, with the first word being
- denoted by 0 (zero). Words are inserted into the current line sepa-
+ Word designators are used to select desired words from the event. A ::
+ separates the event specification from the word designator. It may be
+ omitted if the word designator begins with a ^^, $$, **, --, or %%. Words
+ are numbered from the beginning of the line, with the first word being
+ denoted by 0 (zero). Words are inserted into the current line sepa-
rated by single spaces.
00 ((zzeerroo))
@@ -3507,17 +3524,17 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN
$$ The last argument.
%% The word matched by the most recent `?_s_t_r_i_n_g?' search.
_x--_y A range of words; `-_y' abbreviates `0-_y'.
- ** All of the words but the zeroth. This is a synonym for `_1_-_$'.
- It is not an error to use ** if there is just one word in the
+ ** All of the words but the zeroth. This is a synonym for `_1_-_$'.
+ It is not an error to use ** if there is just one word in the
event; the empty string is returned in that case.
xx** Abbreviates _x_-_$.
xx-- Abbreviates _x_-_$ like xx**, but omits the last word.
- If a word designator is supplied without an event specification, the
+ If a word designator is supplied without an event specification, the
previous command is used as the event.
MMooddiiffiieerrss
- After the optional word designator, there may appear a sequence of one
+ After the optional word designator, there may appear a sequence of one
or more of the following modifiers, each preceded by a `:'.
hh Remove a trailing file name component, leaving only the head.
@@ -3526,70 +3543,70 @@ HHIISSTTOORRYY EEXXPPAANNSSIIOONN
ee Remove all but the trailing suffix.
pp Print the new command but do not execute it.
qq Quote the substituted words, escaping further substitutions.
- xx Quote the substituted words as with qq, but break into words at
+ xx Quote the substituted words as with qq, but break into words at
bbllaannkkss and newlines.
ss//_o_l_d//_n_e_w//
- Substitute _n_e_w for the first occurrence of _o_l_d in the event
- line. Any delimiter can be used in place of /. The final
- delimiter is optional if it is the last character of the event
- line. The delimiter may be quoted in _o_l_d and _n_e_w with a single
- backslash. If & appears in _n_e_w, it is replaced by _o_l_d. A sin-
- gle backslash will quote the &. If _o_l_d is null, it is set to
- the last _o_l_d substituted, or, if no previous history substitu-
+ Substitute _n_e_w for the first occurrence of _o_l_d in the event
+ line. Any delimiter can be used in place of /. The final
+ delimiter is optional if it is the last character of the event
+ line. The delimiter may be quoted in _o_l_d and _n_e_w with a single
+ backslash. If & appears in _n_e_w, it is replaced by _o_l_d. A sin-
+ gle backslash will quote the &. If _o_l_d is null, it is set to
+ the last _o_l_d substituted, or, if no previous history substitu-
tions took place, the last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]] search.
&& Repeat the previous substitution.
gg Cause changes to be applied over the entire event line. This is
- used in conjunction with `::ss' (e.g., `::ggss//_o_l_d//_n_e_w//') or `::&&'.
- If used with `::ss', any delimiter can be used in place of /, and
- the final delimiter is optional if it is the last character of
+ used in conjunction with `::ss' (e.g., `::ggss//_o_l_d//_n_e_w//') or `::&&'.
+ If used with `::ss', any delimiter can be used in place of /, and
+ the final delimiter is optional if it is the last character of
the event line. An aa may be used as a synonym for gg.
- GG Apply the following `ss' modifier once to each word in the event
+ GG Apply the following `ss' modifier once to each word in the event
line.
SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
Unless otherwise noted, each builtin command documented in this section
as accepting options preceded by -- accepts ---- to signify the end of the
- options. For example, the ::, ttrruuee, ffaallssee, and tteesstt builtins do not
+ options. For example, the ::, ttrruuee, ffaallssee, and tteesstt builtins do not
accept options.
:: [_a_r_g_u_m_e_n_t_s]
- No effect; the command does nothing beyond expanding _a_r_g_u_m_e_n_t_s
- and performing any specified redirections. A zero exit code is
+ No effect; the command does nothing beyond expanding _a_r_g_u_m_e_n_t_s
+ and performing any specified redirections. A zero exit code is
returned.
.. _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s]
ssoouurrccee _f_i_l_e_n_a_m_e [_a_r_g_u_m_e_n_t_s]
- Read and execute commands from _f_i_l_e_n_a_m_e in the current shell
- environment and return the exit status of the last command exe-
+ Read and execute commands from _f_i_l_e_n_a_m_e in the current shell
+ environment and return the exit status of the last command exe-
cuted from _f_i_l_e_n_a_m_e. If _f_i_l_e_n_a_m_e does not contain a slash, file
- names in PPAATTHH are used to find the directory containing _f_i_l_e_-
- _n_a_m_e. The file searched for in PPAATTHH need not be executable.
- When bbaasshh is not in _p_o_s_i_x _m_o_d_e, the current directory is
- searched if no file is found in PPAATTHH. If the ssoouurrcceeppaatthh option
- to the sshhoopptt builtin command is turned off, the PPAATTHH is not
- searched. If any _a_r_g_u_m_e_n_t_s are supplied, they become the posi-
- tional parameters when _f_i_l_e_n_a_m_e is executed. Otherwise the
- positional parameters are unchanged. The return status is the
- status of the last command exited within the script (0 if no
- commands are executed), and false if _f_i_l_e_n_a_m_e is not found or
+ names in PPAATTHH are used to find the directory containing _f_i_l_e_-
+ _n_a_m_e. The file searched for in PPAATTHH need not be executable.
+ When bbaasshh is not in _p_o_s_i_x _m_o_d_e, the current directory is
+ searched if no file is found in PPAATTHH. If the ssoouurrcceeppaatthh option
+ to the sshhoopptt builtin command is turned off, the PPAATTHH is not
+ searched. If any _a_r_g_u_m_e_n_t_s are supplied, they become the posi-
+ tional parameters when _f_i_l_e_n_a_m_e is executed. Otherwise the
+ positional parameters are unchanged. The return status is the
+ status of the last command exited within the script (0 if no
+ commands are executed), and false if _f_i_l_e_n_a_m_e is not found or
cannot be read.
aalliiaass [--pp] [_n_a_m_e[=_v_a_l_u_e] ...]
AAlliiaass with no arguments or with the --pp option prints the list of
- aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When
- arguments are supplied, an alias is defined for each _n_a_m_e whose
+ aliases in the form aalliiaass _n_a_m_e=_v_a_l_u_e on standard output. When
+ arguments are supplied, an alias is defined for each _n_a_m_e whose
_v_a_l_u_e is given. A trailing space in _v_a_l_u_e causes the next word
to be checked for alias substitution when the alias is expanded.
- For each _n_a_m_e in the argument list for which no _v_a_l_u_e is sup-
- plied, the name and value of the alias is printed. AAlliiaass
- returns true unless a _n_a_m_e is given for which no alias has been
+ For each _n_a_m_e in the argument list for which no _v_a_l_u_e is sup-
+ plied, the name and value of the alias is printed. AAlliiaass
+ returns true unless a _n_a_m_e is given for which no alias has been
defined.
bbgg [_j_o_b_s_p_e_c ...]
- Resume each suspended job _j_o_b_s_p_e_c in the background, as if it
+ Resume each suspended job _j_o_b_s_p_e_c in the background, as if it
had been started with &&. If _j_o_b_s_p_e_c is not present, the shell's
- notion of the _c_u_r_r_e_n_t _j_o_b is used. bbgg _j_o_b_s_p_e_c returns 0 unless
- run when job control is disabled or, when run with job control
- enabled, any specified _j_o_b_s_p_e_c was not found or was started
+ notion of the _c_u_r_r_e_n_t _j_o_b is used. bbgg _j_o_b_s_p_e_c returns 0 unless
+ run when job control is disabled or, when run with job control
+ enabled, any specified _j_o_b_s_p_e_c was not found or was started
without job control.
bbiinndd [--mm _k_e_y_m_a_p] [--llppssvvPPSSVV]
@@ -3598,28 +3615,28 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
bbiinndd [--mm _k_e_y_m_a_p] --xx _k_e_y_s_e_q:_s_h_e_l_l_-_c_o_m_m_a_n_d
bbiinndd [--mm _k_e_y_m_a_p] _k_e_y_s_e_q:_f_u_n_c_t_i_o_n_-_n_a_m_e
bbiinndd _r_e_a_d_l_i_n_e_-_c_o_m_m_a_n_d
- Display current rreeaaddlliinnee key and function bindings, bind a key
- sequence to a rreeaaddlliinnee function or macro, or set a rreeaaddlliinnee
- variable. Each non-option argument is a command as it would
- appear in _._i_n_p_u_t_r_c, but each binding or command must be passed
- as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
+ Display current rreeaaddlliinnee key and function bindings, bind a key
+ sequence to a rreeaaddlliinnee function or macro, or set a rreeaaddlliinnee
+ variable. Each non-option argument is a command as it would
+ appear in _._i_n_p_u_t_r_c, but each binding or command must be passed
+ as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'.
Options, if supplied, have the following meanings:
--mm _k_e_y_m_a_p
Use _k_e_y_m_a_p as the keymap to be affected by the subsequent
bindings. Acceptable _k_e_y_m_a_p names are _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_-_m_o_v_e_, _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
+ _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_-_m_o_v_e_, _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.
--ll List the names of all rreeaaddlliinnee functions.
- --pp Display rreeaaddlliinnee function names and bindings in such a
+ --pp Display rreeaaddlliinnee function names and bindings in such a
way that they can be re-read.
--PP List current rreeaaddlliinnee function names and bindings.
- --ss Display rreeaaddlliinnee key sequences bound to macros and the
- strings they output in such a way that they can be re-
+ --ss Display rreeaaddlliinnee key sequences bound to macros and the
+ strings they output in such a way that they can be re-
read.
- --SS Display rreeaaddlliinnee key sequences bound to macros and the
+ --SS Display rreeaaddlliinnee key sequences bound to macros and the
strings they output.
- --vv Display rreeaaddlliinnee variable names and values in such a way
+ --vv Display rreeaaddlliinnee variable names and values in such a way
that they can be re-read.
--VV List current rreeaaddlliinnee variable names and values.
--ff _f_i_l_e_n_a_m_e
@@ -3631,133 +3648,134 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--rr _k_e_y_s_e_q
Remove any current binding for _k_e_y_s_e_q.
--xx _k_e_y_s_e_q::_s_h_e_l_l_-_c_o_m_m_a_n_d
- Cause _s_h_e_l_l_-_c_o_m_m_a_n_d to be executed whenever _k_e_y_s_e_q is
- entered. When _s_h_e_l_l_-_c_o_m_m_a_n_d is executed, the shell sets
- the RREEAADDLLIINNEE__LLIINNEE variable to the contents of the rreeaadd--
- lliinnee line buffer and the RREEAADDLLIINNEE__PPOOIINNTT variable to the
+ Cause _s_h_e_l_l_-_c_o_m_m_a_n_d to be executed whenever _k_e_y_s_e_q is
+ entered. When _s_h_e_l_l_-_c_o_m_m_a_n_d is executed, the shell sets
+ the RREEAADDLLIINNEE__LLIINNEE variable to the contents of the rreeaadd--
+ lliinnee line buffer and the RREEAADDLLIINNEE__PPOOIINNTT variable to the
current location of the insertion point. If the executed
- command changes the value of RREEAADDLLIINNEE__LLIINNEE or RREEAADD--
- LLIINNEE__PPOOIINNTT, those new values will be reflected in the
+ command changes the value of RREEAADDLLIINNEE__LLIINNEE or RREEAADD--
+ LLIINNEE__PPOOIINNTT, those new values will be reflected in the
editing state.
- The return value is 0 unless an unrecognized option is given or
+ The return value is 0 unless an unrecognized option is given or
an error occurred.
bbrreeaakk [_n]
- Exit from within a ffoorr, wwhhiillee, uunnttiill, or sseelleecctt loop. If _n is
- specified, break _n levels. _n must be >= 1. If _n is greater
- than the number of enclosing loops, all enclosing loops are
- exited. The return value is 0 unless _n is not greater than or
+ Exit from within a ffoorr, wwhhiillee, uunnttiill, or sseelleecctt loop. If _n is
+ specified, break _n levels. _n must be >= 1. If _n is greater
+ than the number of enclosing loops, all enclosing loops are
+ exited. The return value is 0 unless _n is not greater than or
equal to 1.
bbuuiillttiinn _s_h_e_l_l_-_b_u_i_l_t_i_n [_a_r_g_u_m_e_n_t_s]
- Execute the specified shell builtin, passing it _a_r_g_u_m_e_n_t_s, and
+ Execute the specified shell builtin, passing it _a_r_g_u_m_e_n_t_s, and
return its exit status. This is useful when defining a function
- whose name is the same as a shell builtin, retaining the func-
+ whose name is the same as a shell builtin, retaining the func-
tionality of the builtin within the function. The ccdd builtin is
- commonly redefined this way. The return status is false if
+ commonly redefined this way. The return status is false if
_s_h_e_l_l_-_b_u_i_l_t_i_n is not a shell builtin command.
ccaalllleerr [_e_x_p_r]
Returns the context of any active subroutine call (a shell func-
- tion or a script executed with the .. or ssoouurrccee builtins. With-
+ tion or a script executed with the .. or ssoouurrccee builtins. With-
out _e_x_p_r, ccaalllleerr displays the line number and source filename of
- the current subroutine call. If a non-negative integer is sup-
+ the current subroutine call. If a non-negative integer is sup-
plied as _e_x_p_r, ccaalllleerr displays the line number, subroutine name,
- and source file corresponding to that position in the current
- execution call stack. This extra information may be used, for
- example, to print a stack trace. The current frame is frame 0.
- The return value is 0 unless the shell is not executing a sub-
- routine call or _e_x_p_r does not correspond to a valid position in
+ and source file corresponding to that position in the current
+ execution call stack. This extra information may be used, for
+ example, to print a stack trace. The current frame is frame 0.
+ The return value is 0 unless the shell is not executing a sub-
+ routine call or _e_x_p_r does not correspond to a valid position in
the call stack.
ccdd [--LL||--PP] [_d_i_r]
- Change the current directory to _d_i_r. The variable HHOOMMEE is the
- default _d_i_r. The variable CCDDPPAATTHH defines the search path for
- the directory containing _d_i_r. Alternative directory names in
- CCDDPPAATTHH are separated by a colon (:). A null directory name in
- CCDDPPAATTHH is the same as the current directory, i.e., ``..''. If
- _d_i_r begins with a slash (/), then CCDDPPAATTHH is not used. The --PP
- option says to use the physical directory structure instead of
- following symbolic links (see also the --PP option to the sseett
+ Change the current directory to _d_i_r. The variable HHOOMMEE is the
+ default _d_i_r. The variable CCDDPPAATTHH defines the search path for
+ the directory containing _d_i_r. Alternative directory names in
+ CCDDPPAATTHH are separated by a colon (:). A null directory name in
+ CCDDPPAATTHH is the same as the current directory, i.e., ``..''. If
+ _d_i_r begins with a slash (/), then CCDDPPAATTHH is not used. The --PP
+ option says to use the physical directory structure instead of
+ following symbolic links (see also the --PP option to the sseett
builtin command); the --LL option forces symbolic links to be fol-
- lowed. An argument of -- is equivalent to $$OOLLDDPPWWDD. If a non-
- empty directory name from CCDDPPAATTHH is used, or if -- is the first
- argument, and the directory change is successful, the absolute
+ lowed. An argument of -- is equivalent to $$OOLLDDPPWWDD. If a non-
+ empty directory name from CCDDPPAATTHH is used, or if -- is the first
+ argument, and the directory change is successful, the absolute
pathname of the new working directory is written to the standard
- output. The return value is true if the directory was success-
+ output. The return value is true if the directory was success-
fully changed; false otherwise.
ccoommmmaanndd [--ppVVvv] _c_o_m_m_a_n_d [_a_r_g ...]
- Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function
- lookup. Only builtin commands or commands found in the PPAATTHH are
- executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is
- performed using a default value for PPAATTHH that is guaranteed to
- find all of the standard utilities. If either the --VV or --vv
+ Run _c_o_m_m_a_n_d with _a_r_g_s suppressing the normal shell function
+ lookup. Only builtin commands or commands found in the PPAATTHH are
+ executed. If the --pp option is given, the search for _c_o_m_m_a_n_d is
+ performed using a default value for PPAATTHH that is guaranteed to
+ find all of the standard utilities. If either the --VV or --vv
option is supplied, a description of _c_o_m_m_a_n_d is printed. The --vv
- option causes a single word indicating the command or file name
+ option causes a single word indicating the command or file name
used to invoke _c_o_m_m_a_n_d to be displayed; the --VV option produces a
- more verbose description. If the --VV or --vv option is supplied,
- the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If
+ more verbose description. If the --VV or --vv option is supplied,
+ the exit status is 0 if _c_o_m_m_a_n_d was found, and 1 if not. If
neither option is supplied and an error occurred or _c_o_m_m_a_n_d can-
- not be found, the exit status is 127. Otherwise, the exit sta-
+ not be found, the exit status is 127. Otherwise, the exit sta-
tus of the ccoommmmaanndd builtin is the exit status of _c_o_m_m_a_n_d.
ccoommppggeenn [_o_p_t_i_o_n] [_w_o_r_d]
- Generate possible completion matches for _w_o_r_d according to the
- _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee
- builtin with the exception of --pp and --rr, and write the matches
- to the standard output. When using the --FF or --CC options, the
- various shell variables set by the programmable completion
+ Generate possible completion matches for _w_o_r_d according to the
+ _o_p_t_i_o_ns, which may be any option accepted by the ccoommpplleettee
+ builtin with the exception of --pp and --rr, and write the matches
+ to the standard output. When using the --FF or --CC options, the
+ various shell variables set by the programmable completion
facilities, while available, will not have useful values.
- The matches will be generated in the same way as if the pro-
- grammable completion code had generated them directly from a
+ The matches will be generated in the same way as if the pro-
+ grammable completion code had generated them directly from a
completion specification with the same flags. If _w_o_r_d is speci-
fied, only those completions matching _w_o_r_d will be displayed.
- The return value is true unless an invalid option is supplied,
+ The return value is true unless an invalid option is supplied,
or no matches were generated.
ccoommpplleettee [--aabbccddeeffggjjkkssuuvv] [--oo _c_o_m_p_-_o_p_t_i_o_n] [--EE] [--AA _a_c_t_i_o_n] [--GG _g_l_o_b_p_a_t]
[--WW _w_o_r_d_l_i_s_t] [--FF _f_u_n_c_t_i_o_n] [--CC _c_o_m_m_a_n_d]
[--XX _f_i_l_t_e_r_p_a_t] [--PP _p_r_e_f_i_x] [--SS _s_u_f_f_i_x] _n_a_m_e [_n_a_m_e _._._.]
ccoommpplleettee --pprr [--EE] [_n_a_m_e ...]
- Specify how arguments to each _n_a_m_e should be completed. If the
- --pp option is supplied, or if no options are supplied, existing
- completion specifications are printed in a way that allows them
+ Specify how arguments to each _n_a_m_e should be completed. If the
+ --pp option is supplied, or if no options are supplied, existing
+ completion specifications are printed in a way that allows them
to be reused as input. The --rr option removes a completion spec-
- ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
+ ification for each _n_a_m_e, or, if no _n_a_m_es are supplied, all com-
pletion specifications. The --EE option indicates that the
- remaining options and actions should apply to ``empty'' command
+ remaining options and actions should apply to ``empty'' command
completion; that is, completion attempted on a blank line.
- The process of applying these completion specifications when
- word completion is attempted is described above under PPrroo--
+ The process of applying these completion specifications when
+ word completion is attempted is described above under PPrroo--
ggrraammmmaabbllee CCoommpplleettiioonn.
- Other options, if specified, have the following meanings. The
- arguments to the --GG, --WW, and --XX options (and, if necessary, the
- --PP and --SS options) should be quoted to protect them from expan-
+ Other options, if specified, have the following meanings. The
+ arguments to the --GG, --WW, and --XX options (and, if necessary, the
+ --PP and --SS options) should be quoted to protect them from expan-
sion before the ccoommpplleettee builtin is invoked.
--oo _c_o_m_p_-_o_p_t_i_o_n
- The _c_o_m_p_-_o_p_t_i_o_n controls several aspects of the comp-
- spec's behavior beyond the simple generation of comple-
+ The _c_o_m_p_-_o_p_t_i_o_n controls several aspects of the comp-
+ spec's behavior beyond the simple generation of comple-
tions. _c_o_m_p_-_o_p_t_i_o_n may be one of:
bbaasshhddeeffaauulltt
Perform the rest of the default bbaasshh completions
if the compspec generates no matches.
- ddeeffaauulltt Use readline's default filename completion if
+ ddeeffaauulltt Use readline's default filename completion if
the compspec generates no matches.
ddiirrnnaammeess
- Perform directory name completion if the comp-
+ Perform directory name completion if the comp-
spec generates no matches.
ffiilleennaammeess
- Tell readline that the compspec generates file-
- names, so it can perform any filename-specific
- processing (like adding a slash to directory
- names or suppressing trailing spaces). Intended
- to be used with shell functions.
+ Tell readline that the compspec generates file-
+ names, so it can perform any filename-specific
+ processing (like adding a slash to directory
+ names, quoting special characters, or suppress-
+ ing trailing spaces). Intended to be used with
+ shell functions.
nnoossppaaccee Tell readline not to append a space (the
default) to words completed at the end of the
line.
@@ -3971,7 +3989,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
interprets the following escape sequences:
\\aa alert (bell)
\\bb backspace
- \\cc suppress trailing newline
+ \\cc suppress further output
\\ee an escape character
\\ff form feed
\\nn new line
@@ -4396,7 +4414,9 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
The first character of _d_e_l_i_m is used to terminate the
input line, rather than newline.
--ee If the standard input is coming from a terminal, rreeaaddlliinnee
- (see RREEAADDLLIINNEE above) is used to obtain the line.
+ (see RREEAADDLLIINNEE above) is used to obtain the line. Read-
+ line uses the current (or default, if line editing was
+ not previously active) editing settings.
--ii _t_e_x_t
If rreeaaddlliinnee is being used to read the line, _t_e_x_t is
placed into the editing buffer before editing begins.
@@ -4420,8 +4440,10 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
following the decimal point. This option is only effec-
tive if rreeaadd is reading input from a terminal, pipe, or
other special file; it has no effect when reading from
- regular files. The exit status is greater than 128 if
- the timeout is exceeded.
+ regular files. If _t_i_m_e_o_u_t is 0, rreeaadd returns success if
+ input is available on the specified file descriptor,
+ failure otherwise. The exit status is greater than 128
+ if the timeout is exceeded.
--uu _f_d Read input from file descriptor _f_d.
If no _n_a_m_e_s are supplied, the line read is assigned to the vari-
@@ -4511,7 +4533,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
eemmaaccss Use an emacs-style command line editing inter-
face. This is enabled by default when the shell
is interactive, unless the shell is started with
- the ----nnooeeddiittiinngg option.
+ the ----nnooeeddiittiinngg option. This also affects the
+ editing interface used for rreeaadd --ee.
eerrrrttrraaccee
Same as --EE.
ffuunnccttrraaccee
@@ -4524,8 +4547,8 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
HHIISSTTOORRYY. This option is on by default in inter-
active shells.
iiggnnoorreeeeooff
- The effect is as if the shell command
- ``IGNOREEOF=10'' had been executed (see SShheellll
+ The effect is as if the shell command
+ ``IGNOREEOF=10'' had been executed (see SShheellll
VVaarriiaabblleess above).
kkeeyywwoorrdd Same as --kk.
mmoonniittoorr Same as --mm.
@@ -4539,211 +4562,213 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
pphhyyssiiccaall
Same as --PP.
ppiippeeffaaiill
- If set, the return value of a pipeline is the
- value of the last (rightmost) command to exit
- with a non-zero status, or zero if all commands
- in the pipeline exit successfully. This option
+ If set, the return value of a pipeline is the
+ value of the last (rightmost) command to exit
+ with a non-zero status, or zero if all commands
+ in the pipeline exit successfully. This option
is disabled by default.
- ppoossiixx Change the behavior of bbaasshh where the default
- operation differs from the POSIX standard to
+ ppoossiixx Change the behavior of bbaasshh where the default
+ operation differs from the POSIX standard to
match the standard (_p_o_s_i_x _m_o_d_e).
pprriivviilleeggeedd
Same as --pp.
vveerrbboossee Same as --vv.
- vvii Use a vi-style command line editing interface.
+ vvii Use a vi-style command line editing interface.
+ This also affects the editing interface used for
+ rreeaadd --ee.
xxttrraaccee Same as --xx.
If --oo is supplied with no _o_p_t_i_o_n_-_n_a_m_e, the values of the
- current options are printed. If ++oo is supplied with no
- _o_p_t_i_o_n_-_n_a_m_e, a series of sseett commands to recreate the
- current option settings is displayed on the standard
+ current options are printed. If ++oo is supplied with no
+ _o_p_t_i_o_n_-_n_a_m_e, a series of sseett commands to recreate the
+ current option settings is displayed on the standard
output.
- --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and
- $$BBAASSHH__EENNVV files are not processed, shell functions are
- not inherited from the environment, and the SSHHEELLLLOOPPTTSS
- variable, if it appears in the environment, is ignored.
- If the shell is started with the effective user (group)
- id not equal to the real user (group) id, and the --pp
- option is not supplied, these actions are taken and the
- effective user id is set to the real user id. If the --pp
- option is supplied at startup, the effective user id is
- not reset. Turning this option off causes the effective
- user and group ids to be set to the real user and group
- ids.
+ --pp Turn on _p_r_i_v_i_l_e_g_e_d mode. In this mode, the $$EENNVV and
+ $$BBAASSHH__EENNVV files are not processed, shell functions are
+ not inherited from the environment, and the SSHHEELLLLOOPPTTSS,
+ CCDDPPAATTHH, and GGLLOOBBIIGGNNOORREE variables, if they appear in the
+ environment, are ignored. If the shell is started with
+ the effective user (group) id not equal to the real user
+ (group) id, and the --pp option is not supplied, these
+ actions are taken and the effective user id is set to
+ the real user id. If the --pp option is supplied at
+ startup, the effective user id is not reset. Turning
+ this option off causes the effective user and group ids
+ to be set to the real user and group ids.
--tt Exit after reading and executing one command.
--uu Treat unset variables as an error when performing param-
- eter expansion. If expansion is attempted on an unset
+ eter expansion. If expansion is attempted on an unset
variable, the shell prints an error message, and, if not
interactive, exits with a non-zero status.
--vv Print shell input lines as they are read.
- --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee
+ --xx After expanding each _s_i_m_p_l_e _c_o_m_m_a_n_d, ffoorr command, ccaassee
command, sseelleecctt command, or arithmetic ffoorr command, dis-
- play the expanded value of PPSS44, followed by the command
+ play the expanded value of PPSS44, followed by the command
and its expanded arguments or associated word list.
- --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn
+ --BB The shell performs brace expansion (see BBrraaccee EExxppaannssiioonn
above). This is on by default.
- --CC If set, bbaasshh does not overwrite an existing file with
- the >>, >>&&, and <<>> redirection operators. This may be
+ --CC If set, bbaasshh does not overwrite an existing file with
+ the >>, >>&&, and <<>> redirection operators. This may be
overridden when creating output files by using the redi-
rection operator >>|| instead of >>.
--EE If set, any trap on EERRRR is inherited by shell functions,
- command substitutions, and commands executed in a sub-
- shell environment. The EERRRR trap is normally not inher-
+ command substitutions, and commands executed in a sub-
+ shell environment. The EERRRR trap is normally not inher-
ited in such cases.
--HH Enable !! style history substitution. This option is on
by default when the shell is interactive.
- --PP If set, the shell does not follow symbolic links when
- executing commands such as ccdd that change the current
+ --PP If set, the shell does not follow symbolic links when
+ executing commands such as ccdd that change the current
working directory. It uses the physical directory
structure instead. By default, bbaasshh follows the logical
- chain of directories when performing commands which
+ chain of directories when performing commands which
change the current directory.
- --TT If set, any traps on DDEEBBUUGG and RREETTUURRNN are inherited by
- shell functions, command substitutions, and commands
- executed in a subshell environment. The DDEEBBUUGG and
+ --TT If set, any traps on DDEEBBUUGG and RREETTUURRNN are inherited by
+ shell functions, command substitutions, and commands
+ executed in a subshell environment. The DDEEBBUUGG and
RREETTUURRNN traps are normally not inherited in such cases.
- ---- If no arguments follow this option, then the positional
+ ---- If no arguments follow this option, then the positional
parameters are unset. Otherwise, the positional parame-
- ters are set to the _a_r_gs, even if some of them begin
+ ters are set to the _a_r_gs, even if some of them begin
with a --.
- -- Signal the end of options, cause all remaining _a_r_gs to
+ -- Signal the end of options, cause all remaining _a_r_gs to
be assigned to the positional parameters. The --xx and --vv
options are turned off. If there are no _a_r_gs, the posi-
tional parameters remain unchanged.
- The options are off by default unless otherwise noted. Using +
- rather than - causes these options to be turned off. The
- options can also be specified as arguments to an invocation of
- the shell. The current set of options may be found in $$--. The
+ The options are off by default unless otherwise noted. Using +
+ rather than - causes these options to be turned off. The
+ options can also be specified as arguments to an invocation of
+ the shell. The current set of options may be found in $$--. The
return status is always true unless an invalid option is encoun-
tered.
sshhiifftt [_n]
- The positional parameters from _n+1 ... are renamed to $$11 ........
- Parameters represented by the numbers $$## down to $$##-_n+1 are
- unset. _n must be a non-negative number less than or equal to
- $$##. If _n is 0, no parameters are changed. If _n is not given,
- it is assumed to be 1. If _n is greater than $$##, the positional
- parameters are not changed. The return status is greater than
+ The positional parameters from _n+1 ... are renamed to $$11 ........
+ Parameters represented by the numbers $$## down to $$##-_n+1 are
+ unset. _n must be a non-negative number less than or equal to
+ $$##. If _n is 0, no parameters are changed. If _n is not given,
+ it is assumed to be 1. If _n is greater than $$##, the positional
+ parameters are not changed. The return status is greater than
zero if _n is greater than $$## or less than zero; otherwise 0.
sshhoopptt [--ppqqssuu] [--oo] [_o_p_t_n_a_m_e ...]
Toggle the values of variables controlling optional shell behav-
ior. With no options, or with the --pp option, a list of all set-
table options is displayed, with an indication of whether or not
- each is set. The --pp option causes output to be displayed in a
- form that may be reused as input. Other options have the fol-
+ each is set. The --pp option causes output to be displayed in a
+ form that may be reused as input. Other options have the fol-
lowing meanings:
--ss Enable (set) each _o_p_t_n_a_m_e.
--uu Disable (unset) each _o_p_t_n_a_m_e.
- --qq Suppresses normal output (quiet mode); the return status
+ --qq Suppresses normal output (quiet mode); the return status
indicates whether the _o_p_t_n_a_m_e is set or unset. If multi-
- ple _o_p_t_n_a_m_e arguments are given with --qq, the return sta-
- tus is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero other-
+ ple _o_p_t_n_a_m_e arguments are given with --qq, the return sta-
+ tus is zero if all _o_p_t_n_a_m_e_s are enabled; non-zero other-
wise.
- --oo Restricts the values of _o_p_t_n_a_m_e to be those defined for
+ --oo Restricts the values of _o_p_t_n_a_m_e to be those defined for
the --oo option to the sseett builtin.
- If either --ss or --uu is used with no _o_p_t_n_a_m_e arguments, the dis-
+ If either --ss or --uu is used with no _o_p_t_n_a_m_e arguments, the dis-
play is limited to those options which are set or unset, respec-
- tively. Unless otherwise noted, the sshhoopptt options are disabled
+ tively. Unless otherwise noted, the sshhoopptt options are disabled
(unset) by default.
- The return status when listing options is zero if all _o_p_t_n_a_m_e_s
- are enabled, non-zero otherwise. When setting or unsetting
- options, the return status is zero unless an _o_p_t_n_a_m_e is not a
+ The return status when listing options is zero if all _o_p_t_n_a_m_e_s
+ are enabled, non-zero otherwise. When setting or unsetting
+ options, the return status is zero unless an _o_p_t_n_a_m_e is not a
valid shell option.
The list of sshhoopptt options is:
- aauuttooccdd If set, a command name that is the name of a directory
- is executed as if it were the argument to the ccdd com-
+ aauuttooccdd If set, a command name that is the name of a directory
+ is executed as if it were the argument to the ccdd com-
mand. This option is only used by interactive shells.
ccddaabbllee__vvaarrss
- If set, an argument to the ccdd builtin command that is
- not a directory is assumed to be the name of a variable
+ If set, an argument to the ccdd builtin command that is
+ not a directory is assumed to be the name of a variable
whose value is the directory to change to.
ccddssppeellll If set, minor errors in the spelling of a directory com-
- ponent in a ccdd command will be corrected. The errors
+ ponent in a ccdd command will be corrected. The errors
checked for are transposed characters, a missing charac-
- ter, and one character too many. If a correction is
- found, the corrected file name is printed, and the com-
- mand proceeds. This option is only used by interactive
+ ter, and one character too many. If a correction is
+ found, the corrected file name is printed, and the com-
+ mand proceeds. This option is only used by interactive
shells.
cchheecckkhhaasshh
If set, bbaasshh checks that a command found in the hash ta-
- ble exists before trying to execute it. If a hashed
- command no longer exists, a normal path search is per-
+ ble exists before trying to execute it. If a hashed
+ command no longer exists, a normal path search is per-
formed.
cchheecckkjjoobbss
If set, bbaasshh lists the status of any stopped and running
- jobs before exiting an interactive shell. If any jobs
+ jobs before exiting an interactive shell. If any jobs
are running, this causes the exit to be deferred until a
- second exit is attempted without an intervening command
- (see JJOOBB CCOONNTTRROOLL above). The shell always postpones
+ second exit is attempted without an intervening command
+ (see JJOOBB CCOONNTTRROOLL above). The shell always postpones
exiting if any jobs are stopped.
cchheecckkwwiinnssiizzee
- If set, bbaasshh checks the window size after each command
- and, if necessary, updates the values of LLIINNEESS and CCOOLL--
+ If set, bbaasshh checks the window size after each command
+ and, if necessary, updates the values of LLIINNEESS and CCOOLL--
UUMMNNSS.
- ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple-
- line command in the same history entry. This allows
+ ccmmddhhiisstt If set, bbaasshh attempts to save all lines of a multiple-
+ line command in the same history entry. This allows
easy re-editing of multi-line commands.
ccoommppaatt3311
If set, bbaasshh changes its behavior to that of version 3.1
with respect to quoted arguments to the conditional com-
mand's =~ operator.
ddiirrssppeellll
- If set, bbaasshh attempts spelling correction on directory
- names during word completion if the directory name ini-
+ If set, bbaasshh attempts spelling correction on directory
+ names during word completion if the directory name ini-
tially supplied does not exist.
- ddoottgglloobb If set, bbaasshh includes filenames beginning with a `.' in
+ ddoottgglloobb If set, bbaasshh includes filenames beginning with a `.' in
the results of pathname expansion.
eexxeeccffaaiill
If set, a non-interactive shell will not exit if it can-
- not execute the file specified as an argument to the
- eexxeecc builtin command. An interactive shell does not
+ not execute the file specified as an argument to the
+ eexxeecc builtin command. An interactive shell does not
exit if eexxeecc fails.
eexxppaanndd__aalliiaasseess
- If set, aliases are expanded as described above under
+ If set, aliases are expanded as described above under
AALLIIAASSEESS. This option is enabled by default for interac-
tive shells.
eexxttddeebbuugg
- If set, behavior intended for use by debuggers is
+ If set, behavior intended for use by debuggers is
enabled:
11.. The --FF option to the ddeeccllaarree builtin displays the
source file name and line number corresponding to
each function name supplied as an argument.
- 22.. If the command run by the DDEEBBUUGG trap returns a
- non-zero value, the next command is skipped and
+ 22.. If the command run by the DDEEBBUUGG trap returns a
+ non-zero value, the next command is skipped and
not executed.
- 33.. If the command run by the DDEEBBUUGG trap returns a
- value of 2, and the shell is executing in a sub-
- routine (a shell function or a shell script exe-
- cuted by the .. or ssoouurrccee builtins), a call to
+ 33.. If the command run by the DDEEBBUUGG trap returns a
+ value of 2, and the shell is executing in a sub-
+ routine (a shell function or a shell script exe-
+ cuted by the .. or ssoouurrccee builtins), a call to
rreettuurrnn is simulated.
- 44.. BBAASSHH__AARRGGCC and BBAASSHH__AARRGGVV are updated as described
+ 44.. BBAASSHH__AARRGGCC and BBAASSHH__AARRGGVV are updated as described
in their descriptions above.
- 55.. Function tracing is enabled: command substitu-
+ 55.. Function tracing is enabled: command substitu-
tion, shell functions, and subshells invoked with
(( _c_o_m_m_a_n_d )) inherit the DDEEBBUUGG and RREETTUURRNN traps.
- 66.. Error tracing is enabled: command substitution,
- shell functions, and subshells invoked with ((
+ 66.. Error tracing is enabled: command substitution,
+ shell functions, and subshells invoked with ((
_c_o_m_m_a_n_d )) inherit the EERRRROORR trap.
eexxttgglloobb If set, the extended pattern matching features described
above under PPaatthhnnaammee EExxppaannssiioonn are enabled.
eexxttqquuoottee
- If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed
- within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double
+ If set, $$'_s_t_r_i_n_g' and $$"_s_t_r_i_n_g" quoting is performed
+ within $${{_p_a_r_a_m_e_t_e_r}} expansions enclosed in double
quotes. This option is enabled by default.
ffaaiillgglloobb
- If set, patterns which fail to match filenames during
+ If set, patterns which fail to match filenames during
pathname expansion result in an expansion error.
ffoorrccee__ffiiggnnoorree
- If set, the suffixes specified by the FFIIGGNNOORREE shell
- variable cause words to be ignored when performing word
+ If set, the suffixes specified by the FFIIGGNNOORREE shell
+ variable cause words to be ignored when performing word
completion even if the ignored words are the only possi-
ble completions. See SSHHEELLLL VVAARRIIAABBLLEESS above for a
- description of FFIIGGNNOORREE. This option is enabled by
+ description of FFIIGGNNOORREE. This option is enabled by
default.
gglloobbssttaarr
If set, the pattern **** used in a filename expansion con-
@@ -4754,58 +4779,58 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
If set, shell error messages are written in the standard
GNU error message format.
hhiissttaappppeenndd
- If set, the history list is appended to the file named
- by the value of the HHIISSTTFFIILLEE variable when the shell
+ If set, the history list is appended to the file named
+ by the value of the HHIISSTTFFIILLEE variable when the shell
exits, rather than overwriting the file.
hhiissttrreeeeddiitt
- If set, and rreeaaddlliinnee is being used, a user is given the
+ If set, and rreeaaddlliinnee is being used, a user is given the
opportunity to re-edit a failed history substitution.
hhiissttvveerriiffyy
- If set, and rreeaaddlliinnee is being used, the results of his-
- tory substitution are not immediately passed to the
- shell parser. Instead, the resulting line is loaded
+ If set, and rreeaaddlliinnee is being used, the results of his-
+ tory substitution are not immediately passed to the
+ shell parser. Instead, the resulting line is loaded
into the rreeaaddlliinnee editing buffer, allowing further modi-
fication.
hhoossttccoommpplleettee
If set, and rreeaaddlliinnee is being used, bbaasshh will attempt to
- perform hostname completion when a word containing a @@
- is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE
+ perform hostname completion when a word containing a @@
+ is being completed (see CCoommpplleettiinngg under RREEAADDLLIINNEE
above). This is enabled by default.
hhuuppoonneexxiitt
If set, bbaasshh will send SSIIGGHHUUPP to all jobs when an inter-
active login shell exits.
iinntteerraaccttiivvee__ccoommmmeennttss
If set, allow a word beginning with ## to cause that word
- and all remaining characters on that line to be ignored
- in an interactive shell (see CCOOMMMMEENNTTSS above). This
+ and all remaining characters on that line to be ignored
+ in an interactive shell (see CCOOMMMMEENNTTSS above). This
option is enabled by default.
- lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
+ lliitthhiisstt If set, and the ccmmddhhiisstt option is enabled, multi-line
commands are saved to the history with embedded newlines
rather than using semicolon separators where possible.
llooggiinn__sshheellll
- The shell sets this option if it is started as a login
- shell (see IINNVVOOCCAATTIIOONN above). The value may not be
+ The shell sets this option if it is started as a login
+ shell (see IINNVVOOCCAATTIIOONN above). The value may not be
changed.
mmaaiillwwaarrnn
- If set, and a file that bbaasshh is checking for mail has
- been accessed since the last time it was checked, the
- message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis-
+ If set, and a file that bbaasshh is checking for mail has
+ been accessed since the last time it was checked, the
+ message ``The mail in _m_a_i_l_f_i_l_e has been read'' is dis-
played.
nnoo__eemmppttyy__ccmmdd__ccoommpplleettiioonn
- If set, and rreeaaddlliinnee is being used, bbaasshh will not
+ If set, and rreeaaddlliinnee is being used, bbaasshh will not
attempt to search the PPAATTHH for possible completions when
completion is attempted on an empty line.
nnooccaasseegglloobb
- If set, bbaasshh matches filenames in a case-insensitive
+ If set, bbaasshh matches filenames in a case-insensitive
fashion when performing pathname expansion (see PPaatthhnnaammee
EExxppaannssiioonn above).
nnooccaasseemmaattcchh
- If set, bbaasshh matches patterns in a case-insensitive
+ If set, bbaasshh matches patterns in a case-insensitive
fashion when performing matching while executing ccaassee or
[[[[ conditional commands.
nnuullllgglloobb
- If set, bbaasshh allows patterns which match no files (see
- PPaatthhnnaammee EExxppaannssiioonn above) to expand to a null string,
+ If set, bbaasshh allows patterns which match no files (see
+ PPaatthhnnaammee EExxppaannssiioonn above) to expand to a null string,
rather than themselves.
pprrooggccoommpp
If set, the programmable completion facilities (see PPrroo--
@@ -4813,47 +4838,47 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
enabled by default.
pprroommppttvvaarrss
If set, prompt strings undergo parameter expansion, com-
- mand substitution, arithmetic expansion, and quote
- removal after being expanded as described in PPRROOMMPPTTIINNGG
+ mand substitution, arithmetic expansion, and quote
+ removal after being expanded as described in PPRROOMMPPTTIINNGG
above. This option is enabled by default.
rreessttrriicctteedd__sshheellll
- The shell sets this option if it is started in
+ The shell sets this option if it is started in
restricted mode (see RREESSTTRRIICCTTEEDD SSHHEELLLL below). The value
- may not be changed. This is not reset when the startup
- files are executed, allowing the startup files to dis-
+ may not be changed. This is not reset when the startup
+ files are executed, allowing the startup files to dis-
cover whether or not a shell is restricted.
sshhiifftt__vveerrbboossee
- If set, the sshhiifftt builtin prints an error message when
+ If set, the sshhiifftt builtin prints an error message when
the shift count exceeds the number of positional parame-
ters.
ssoouurrcceeppaatthh
If set, the ssoouurrccee (..) builtin uses the value of PPAATTHH to
- find the directory containing the file supplied as an
+ find the directory containing the file supplied as an
argument. This option is enabled by default.
xxppgg__eecchhoo
- If set, the eecchhoo builtin expands backslash-escape
+ If set, the eecchhoo builtin expands backslash-escape
sequences by default.
ssuussppeenndd [--ff]
- Suspend the execution of this shell until it receives a SSIIGGCCOONNTT
+ Suspend the execution of this shell until it receives a SSIIGGCCOONNTT
signal. A login shell cannot be suspended; the --ff option can be
used to override this and force the suspension. The return sta-
- tus is 0 unless the shell is a login shell and --ff is not sup-
+ tus is 0 unless the shell is a login shell and --ff is not sup-
plied, or if job control is not enabled.
tteesstt _e_x_p_r
[[ _e_x_p_r ]]
- Return a status of 0 or 1 depending on the evaluation of the
- conditional expression _e_x_p_r. Each operator and operand must be
- a separate argument. Expressions are composed of the primaries
- described above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS. tteesstt does not
+ Return a status of 0 or 1 depending on the evaluation of the
+ conditional expression _e_x_p_r. Each operator and operand must be
+ a separate argument. Expressions are composed of the primaries
+ described above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS. tteesstt does not
accept any options, nor does it accept and ignore an argument of
---- as signifying the end of options.
- Expressions may be combined using the following operators,
+ Expressions may be combined using the following operators,
listed in decreasing order of precedence. The evaluation
depends on the number of arguments; see below.
!! _e_x_p_r True if _e_x_p_r is false.
(( _e_x_p_r ))
- Returns the value of _e_x_p_r. This may be used to override
+ Returns the value of _e_x_p_r. This may be used to override
the normal precedence of operators.
_e_x_p_r_1 -aa _e_x_p_r_2
True if both _e_x_p_r_1 and _e_x_p_r_2 are true.
@@ -4870,108 +4895,108 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
null.
2 arguments
If the first argument is !!, the expression is true if and
- only if the second argument is null. If the first argu-
- ment is one of the unary conditional operators listed
- above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
+ only if the second argument is null. If the first argu-
+ ment is one of the unary conditional operators listed
+ above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the expression is
true if the unary test is true. If the first argument is
not a valid unary conditional operator, the expression is
false.
3 arguments
- If the second argument is one of the binary conditional
+ If the second argument is one of the binary conditional
operators listed above under CCOONNDDIITTIIOONNAALL EEXXPPRREESSSSIIOONNSS, the
result of the expression is the result of the binary test
- using the first and third arguments as operands. The --aa
- and --oo operators are considered binary operators when
- there are three arguments. If the first argument is !!,
- the value is the negation of the two-argument test using
+ using the first and third arguments as operands. The --aa
+ and --oo operators are considered binary operators when
+ there are three arguments. If the first argument is !!,
+ the value is the negation of the two-argument test using
the second and third arguments. If the first argument is
exactly (( and the third argument is exactly )), the result
- is the one-argument test of the second argument. Other-
+ is the one-argument test of the second argument. Other-
wise, the expression is false.
4 arguments
If the first argument is !!, the result is the negation of
- the three-argument expression composed of the remaining
+ the three-argument expression composed of the remaining
arguments. Otherwise, the expression is parsed and eval-
- uated according to precedence using the rules listed
+ uated according to precedence using the rules listed
above.
5 or more arguments
- The expression is parsed and evaluated according to
+ The expression is parsed and evaluated according to
precedence using the rules listed above.
- ttiimmeess Print the accumulated user and system times for the shell and
+ ttiimmeess Print the accumulated user and system times for the shell and
for processes run from the shell. The return status is 0.
ttrraapp [--llpp] [[_a_r_g] _s_i_g_s_p_e_c ...]
- The command _a_r_g is to be read and executed when the shell
- receives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a
- single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
- original disposition (the value it had upon entrance to the
- shell). If _a_r_g is the null string the signal specified by each
- _s_i_g_s_p_e_c is ignored by the shell and by the commands it invokes.
- If _a_r_g is not present and --pp has been supplied, then the trap
- commands associated with each _s_i_g_s_p_e_c are displayed. If no
- arguments are supplied or if only --pp is given, ttrraapp prints the
- list of commands associated with each signal. The --ll option
- causes the shell to print a list of signal names and their cor-
- responding numbers. Each _s_i_g_s_p_e_c is either a signal name
- defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
- case insensitive and the SIG prefix is optional. If a _s_i_g_s_p_e_c
- is EEXXIITT (0) the command _a_r_g is executed on exit from the shell.
- If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is executed before every
+ The command _a_r_g is to be read and executed when the shell
+ receives signal(s) _s_i_g_s_p_e_c. If _a_r_g is absent (and there is a
+ single _s_i_g_s_p_e_c) or --, each specified signal is reset to its
+ original disposition (the value it had upon entrance to the
+ shell). If _a_r_g is the null string the signal specified by each
+ _s_i_g_s_p_e_c is ignored by the shell and by the commands it invokes.
+ If _a_r_g is not present and --pp has been supplied, then the trap
+ commands associated with each _s_i_g_s_p_e_c are displayed. If no
+ arguments are supplied or if only --pp is given, ttrraapp prints the
+ list of commands associated with each signal. The --ll option
+ causes the shell to print a list of signal names and their cor-
+ responding numbers. Each _s_i_g_s_p_e_c is either a signal name
+ defined in <_s_i_g_n_a_l_._h>, or a signal number. Signal names are
+ case insensitive and the SIG prefix is optional. If a _s_i_g_s_p_e_c
+ is EEXXIITT (0) the command _a_r_g is executed on exit from the shell.
+ If a _s_i_g_s_p_e_c is DDEEBBUUGG, the command _a_r_g is executed before every
_s_i_m_p_l_e _c_o_m_m_a_n_d, _f_o_r command, _c_a_s_e command, _s_e_l_e_c_t command, every
arithmetic _f_o_r command, and before the first command executes in
- a shell function (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the
- description of the eexxttddeebbuugg option to the sshhoopptt builtin for
- details of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is EERRRR,
- the command _a_r_g is executed whenever a simple command has a
- non-zero exit status, subject to the following conditions. The
- EERRRR trap is not executed if the failed command is part of the
- command list immediately following a wwhhiillee or uunnttiill keyword,
- part of the test in an _i_f statement, part of a command executed
- in a &&&& or |||| list, or if the command's return value is being
- inverted via !!. These are the same conditions obeyed by the
+ a shell function (see SSHHEELLLL GGRRAAMMMMAARR above). Refer to the
+ description of the eexxttddeebbuugg option to the sshhoopptt builtin for
+ details of its effect on the DDEEBBUUGG trap. If a _s_i_g_s_p_e_c is EERRRR,
+ the command _a_r_g is executed whenever a simple command has a
+ non-zero exit status, subject to the following conditions. The
+ EERRRR trap is not executed if the failed command is part of the
+ command list immediately following a wwhhiillee or uunnttiill keyword,
+ part of the test in an _i_f statement, part of a command executed
+ in a &&&& or |||| list, or if the command's return value is being
+ inverted via !!. These are the same conditions obeyed by the
eerrrreexxiitt option. If a _s_i_g_s_p_e_c is RREETTUURRNN, the command _a_r_g is exe-
cuted each time a shell function or a script executed with the ..
- or ssoouurrccee builtins finishes executing. Signals ignored upon
- entry to the shell cannot be trapped or reset. Trapped signals
+ or ssoouurrccee builtins finishes executing. Signals ignored upon
+ entry to the shell cannot be trapped or reset. Trapped signals
that are not being ignored are reset to their original values in
- a child process when it is created. The return status is false
+ a child process when it is created. The return status is false
if any _s_i_g_s_p_e_c is invalid; otherwise ttrraapp returns true.
ttyyppee [--aaffttppPP] _n_a_m_e [_n_a_m_e ...]
- With no options, indicate how each _n_a_m_e would be interpreted if
+ With no options, indicate how each _n_a_m_e would be interpreted if
used as a command name. If the --tt option is used, ttyyppee prints a
- string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
- _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
- builtin, or disk file, respectively. If the _n_a_m_e is not found,
- then nothing is printed, and an exit status of false is
- returned. If the --pp option is used, ttyyppee either returns the
+ string which is one of _a_l_i_a_s, _k_e_y_w_o_r_d, _f_u_n_c_t_i_o_n, _b_u_i_l_t_i_n, or
+ _f_i_l_e if _n_a_m_e is an alias, shell reserved word, function,
+ builtin, or disk file, respectively. If the _n_a_m_e is not found,
+ then nothing is printed, and an exit status of false is
+ returned. If the --pp option is used, ttyyppee either returns the
name of the disk file that would be executed if _n_a_m_e were speci-
fied as a command name, or nothing if ``type -t name'' would not
- return _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
+ return _f_i_l_e. The --PP option forces a PPAATTHH search for each _n_a_m_e,
even if ``type -t name'' would not return _f_i_l_e. If a command is
- hashed, --pp and --PP print the hashed value, not necessarily the
+ hashed, --pp and --PP print the hashed value, not necessarily the
file that appears first in PPAATTHH. If the --aa option is used, ttyyppee
- prints all of the places that contain an executable named _n_a_m_e.
- This includes aliases and functions, if and only if the --pp
- option is not also used. The table of hashed commands is not
- consulted when using --aa. The --ff option suppresses shell func-
- tion lookup, as with the ccoommmmaanndd builtin. ttyyppee returns true if
+ prints all of the places that contain an executable named _n_a_m_e.
+ This includes aliases and functions, if and only if the --pp
+ option is not also used. The table of hashed commands is not
+ consulted when using --aa. The --ff option suppresses shell func-
+ tion lookup, as with the ccoommmmaanndd builtin. ttyyppee returns true if
all of the arguments are found, false if any are not found.
uulliimmiitt [--HHSSTTaabbccddeeffiillmmnnppqqrrssttuuvvxx [_l_i_m_i_t]]
- Provides control over the resources available to the shell and
- to processes started by it, on systems that allow such control.
+ Provides control over the resources available to the shell and
+ to processes started by it, on systems that allow such control.
The --HH and --SS options specify that the hard or soft limit is set
- for the given resource. A hard limit cannot be increased by a
- non-root user once it is set; a soft limit may be increased up
- to the value of the hard limit. If neither --HH nor --SS is speci-
+ for the given resource. A hard limit cannot be increased by a
+ non-root user once it is set; a soft limit may be increased up
+ to the value of the hard limit. If neither --HH nor --SS is speci-
fied, both the soft and hard limits are set. The value of _l_i_m_i_t
can be a number in the unit specified for the resource or one of
the special values hhaarrdd, ssoofftt, or uunnlliimmiitteedd, which stand for the
- current hard limit, the current soft limit, and no limit,
- respectively. If _l_i_m_i_t is omitted, the current value of the
- soft limit of the resource is printed, unless the --HH option is
+ current hard limit, the current soft limit, and no limit,
+ respectively. If _l_i_m_i_t is omitted, the current value of the
+ soft limit of the resource is printed, unless the --HH option is
given. When more than one resource is specified, the limit name
and unit are printed before the value. Other options are inter-
preted as follows:
@@ -4980,7 +5005,7 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--cc The maximum size of core files created
--dd The maximum size of a process's data segment
--ee The maximum scheduling priority ("nice")
- --ff The maximum size of files written by the shell and its
+ --ff The maximum size of files written by the shell and its
children
--ii The maximum number of pending signals
--ll The maximum size that may be locked into memory
@@ -4992,65 +5017,65 @@ SSHHEELLLL BBUUIILLTTIINN CCOOMMMMAANNDDSS
--rr The maximum real-time scheduling priority
--ss The maximum stack size
--tt The maximum amount of cpu time in seconds
- --uu The maximum number of processes available to a single
+ --uu The maximum number of processes available to a single
user
- --vv The maximum amount of virtual memory available to the
+ --vv The maximum amount of virtual memory available to the
shell
--xx The maximum number of file locks
--TT The maximum number of threads
If _l_i_m_i_t is given, it is the new value of the specified resource
(the --aa option is display only). If no option is given, then --ff
- is assumed. Values are in 1024-byte increments, except for --tt,
- which is in seconds, --pp, which is in units of 512-byte blocks,
- and --TT, --bb, --nn, and --uu, which are unscaled values. The return
+ is assumed. Values are in 1024-byte increments, except for --tt,
+ which is in seconds, --pp, which is in units of 512-byte blocks,
+ and --TT, --bb, --nn, and --uu, which are unscaled values. The return
status is 0 unless an invalid option or argument is supplied, or
an error occurs while setting a new limit.
uummaasskk [--pp] [--SS] [_m_o_d_e]
The user file-creation mask is set to _m_o_d_e. If _m_o_d_e begins with
- a digit, it is interpreted as an octal number; otherwise it is
- interpreted as a symbolic mode mask similar to that accepted by
- _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
- printed. The --SS option causes the mask to be printed in sym-
- bolic form; the default output is an octal number. If the --pp
+ a digit, it is interpreted as an octal number; otherwise it is
+ interpreted as a symbolic mode mask similar to that accepted by
+ _c_h_m_o_d(1). If _m_o_d_e is omitted, the current value of the mask is
+ printed. The --SS option causes the mask to be printed in sym-
+ bolic form; the default output is an octal number. If the --pp
option is supplied, and _m_o_d_e is omitted, the output is in a form
that may be reused as input. The return status is 0 if the mode
- was successfully changed or if no _m_o_d_e argument was supplied,
+ was successfully changed or if no _m_o_d_e argument was supplied,
and false otherwise.
uunnaalliiaass [-aa] [_n_a_m_e ...]
- Remove each _n_a_m_e from the list of defined aliases. If --aa is
- supplied, all alias definitions are removed. The return value
+ Remove each _n_a_m_e from the list of defined aliases. If --aa is
+ supplied, all alias definitions are removed. The return value
is true unless a supplied _n_a_m_e is not a defined alias.
uunnsseett [-ffvv] [_n_a_m_e ...]
- For each _n_a_m_e, remove the corresponding variable or function.
+ For each _n_a_m_e, remove the corresponding variable or function.
If no options are supplied, or the --vv option is given, each _n_a_m_e
- refers to a shell variable. Read-only variables may not be
- unset. If --ff is specified, each _n_a_m_e refers to a shell func-
- tion, and the function definition is removed. Each unset vari-
- able or function is removed from the environment passed to sub-
- sequent commands. If any of RRAANNDDOOMM, SSEECCOONNDDSS, LLIINNEENNOO, HHIISSTTCCMMDD,
+ refers to a shell variable. Read-only variables may not be
+ unset. If --ff is specified, each _n_a_m_e refers to a shell func-
+ tion, and the function definition is removed. Each unset vari-
+ able or function is removed from the environment passed to sub-
+ sequent commands. If any of RRAANNDDOOMM, SSEECCOONNDDSS, LLIINNEENNOO, HHIISSTTCCMMDD,
FFUUNNCCNNAAMMEE, GGRROOUUPPSS, or DDIIRRSSTTAACCKK are unset, they lose their special
- properties, even if they are subsequently reset. The exit sta-
+ properties, even if they are subsequently reset. The exit sta-
tus is true unless a _n_a_m_e is readonly.
wwaaiitt [_n _._._.]
- Wait for each specified process and return its termination sta-
- tus. Each _n may be a process ID or a job specification; if a
- job spec is given, all processes in that job's pipeline are
- waited for. If _n is not given, all currently active child pro-
- cesses are waited for, and the return status is zero. If _n
- specifies a non-existent process or job, the return status is
- 127. Otherwise, the return status is the exit status of the
+ Wait for each specified process and return its termination sta-
+ tus. Each _n may be a process ID or a job specification; if a
+ job spec is given, all processes in that job's pipeline are
+ waited for. If _n is not given, all currently active child pro-
+ cesses are waited for, and the return status is zero. If _n
+ specifies a non-existent process or job, the return status is
+ 127. Otherwise, the return status is the exit status of the
last process or job waited for.
RREESSTTRRIICCTTEEDD SSHHEELLLL
If bbaasshh is started with the name rrbbaasshh, or the --rr option is supplied at
- invocation, the shell becomes restricted. A restricted shell is used
- to set up an environment more controlled than the standard shell. It
- behaves identically to bbaasshh with the exception that the following are
+ invocation, the shell becomes restricted. A restricted shell is used
+ to set up an environment more controlled than the standard shell. It
+ behaves identically to bbaasshh with the exception that the following are
disallowed or not performed:
+o changing directories with ccdd
@@ -5059,16 +5084,16 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o specifying command names containing //
- +o specifying a file name containing a // as an argument to the ..
+ +o specifying a file name containing a // as an argument to the ..
builtin command
- +o Specifying a filename containing a slash as an argument to the
+ +o Specifying a filename containing a slash as an argument to the
--pp option to the hhaasshh builtin command
- +o importing function definitions from the shell environment at
+ +o importing function definitions from the shell environment at
startup
- +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
+ +o parsing the value of SSHHEELLLLOOPPTTSS from the shell environment at
startup
+o redirecting output using the >, >|, <>, >&, &>, and >> redirect-
@@ -5077,10 +5102,10 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
+o using the eexxeecc builtin command to replace the shell with another
command
- +o adding or deleting builtin commands with the --ff and --dd options
+ +o adding or deleting builtin commands with the --ff and --dd options
to the eennaabbllee builtin command
- +o Using the eennaabbllee builtin command to enable disabled shell
+ +o Using the eennaabbllee builtin command to enable disabled shell
builtins
+o specifying the --pp option to the ccoommmmaanndd builtin command
@@ -5090,14 +5115,14 @@ RREESSTTRRIICCTTEEDD SSHHEELLLL
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed (see CCOOMM--
- MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
+ MMAANNDD EEXXEECCUUTTIIOONN above), rrbbaasshh turns off any restrictions in the shell
spawned to execute the script.
SSEEEE AALLSSOO
_B_a_s_h _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, Brian Fox and Chet Ramey
_T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
_T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
- _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
+ _P_o_r_t_a_b_l_e _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m _I_n_t_e_r_f_a_c_e _(_P_O_S_I_X_) _P_a_r_t _2_: _S_h_e_l_l _a_n_d _U_t_i_l_i_-
_t_i_e_s, IEEE
_s_h(1), _k_s_h(1), _c_s_h(1)
_e_m_a_c_s(1), _v_i(1)
@@ -5113,7 +5138,7 @@ FFIILLEESS
_~_/_._b_a_s_h_r_c
The individual per-interactive-shell startup file
_~_/_._b_a_s_h___l_o_g_o_u_t
- The individual login shell cleanup file, executed when a login
+ The individual login shell cleanup file, executed when a login
shell exits
_~_/_._i_n_p_u_t_r_c
Individual _r_e_a_d_l_i_n_e initialization file
@@ -5127,14 +5152,14 @@ AAUUTTHHOORRSS
BBUUGG RREEPPOORRTTSS
If you find a bug in bbaasshh,, you should report it. But first, you should
- make sure that it really is a bug, and that it appears in the latest
- version of bbaasshh. The latest version is always available from
+ make sure that it really is a bug, and that it appears in the latest
+ version of bbaasshh. The latest version is always available from
_f_t_p_:_/_/_f_t_p_._g_n_u_._o_r_g_/_p_u_b_/_b_a_s_h_/.
- Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
- command to submit a bug report. If you have a fix, you are encouraged
- to mail that as well! Suggestions and `philosophical' bug reports may
- be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
+ Once you have determined that a bug actually exists, use the _b_a_s_h_b_u_g
+ command to submit a bug report. If you have a fix, you are encouraged
+ to mail that as well! Suggestions and `philosophical' bug reports may
+ be mailed to _b_u_g_-_b_a_s_h_@_g_n_u_._o_r_g or posted to the Usenet newsgroup
ggnnuu..bbaasshh..bbuugg.
ALL bug reports should include:
@@ -5145,7 +5170,7 @@ BBUUGG RREEPPOORRTTSS
A description of the bug behaviour
A short script or `recipe' which exercises the bug
- _b_a_s_h_b_u_g inserts the first three items automatically into the template
+ _b_a_s_h_b_u_g inserts the first three items automatically into the template
it provides for filing a bug report.
Comments and bug reports concerning this manual page should be directed
@@ -5162,16 +5187,16 @@ BBUUGGSS
Shell builtin commands and functions are not stoppable/restartable.
Compound commands and command sequences of the form `a ; b ; c' are not
- handled gracefully when process suspension is attempted. When a
- process is stopped, the shell immediately executes the next command in
- the sequence. It suffices to place the sequence of commands between
- parentheses to force it into a subshell, which may be stopped as a
+ handled gracefully when process suspension is attempted. When a
+ process is stopped, the shell immediately executes the next command in
+ the sequence. It suffices to place the sequence of commands between
+ parentheses to force it into a subshell, which may be stopped as a
unit.
- Commands inside of $$((...)) command substitution are not parsed until
- substitution is attempted. This will delay error reporting until some
+ Commands inside of $$((...)) command substitution are not parsed until
+ substitution is attempted. This will delay error reporting until some
time after the command is entered. For example, unmatched parentheses,
- even inside shell comments, will result in error messages while the
+ even inside shell comments, will result in error messages while the
construct is being read.
Array variables may not (yet) be exported.
@@ -5180,4 +5205,4 @@ BBUUGGSS
-GNU Bash-4.0 2008 July 6 BASH(1)
+GNU Bash-4.0 2008 October 28 BASH(1)