diff -u bash-4.2.is/doc/bashref.texi bash-4.2.new/doc/bashref.texi --- bash-4.2.is/doc/bashref.texi 2011-01-16 21:31:57.000000000 +0100 +++ bash-4.2.new/doc/bashref.texi 2011-09-11 10:36:29.000000000 +0200 @@ -85,7 +85,7 @@ features that only appear in Bash. Some of the shells that Bash has borrowed concepts from are the Bourne Shell (@file{sh}), the Korn Shell (@file{ksh}), and the C-shell (@file{csh} and its successor, -@file{tcsh}). The following menu breaks the features up into +@file{tcsh}). The following menu breaks the features up into categories based upon which one of these other shells inspired the feature. @@ -627,7 +627,7 @@ @cindex command timing The format for a pipeline is @example -[@code{time} [@code{-p}]] [@code{!}] @var{command1} [ [@code{|} or @code{|&}] @var{command2} @dots{}] +[time [-p]] [!] @var{command1} [ | or |& @var{command2} ] @dots{} @end example @noindent @@ -771,9 +771,11 @@ @rwindex do @rwindex done The syntax of the @code{until} command is: + @example until @var{test-commands}; do @var{consequent-commands}; done @end example + Execute @var{consequent-commands} as long as @var{test-commands} has an exit status which is not zero. The return status is the exit status of the last command executed @@ -782,6 +784,7 @@ @item while @rwindex while The syntax of the @code{while} command is: + @example while @var{test-commands}; do @var{consequent-commands}; done @end example @@ -798,6 +801,7 @@ @example for @var{name} [ [in [@var{words} @dots{}] ] ; ] do @var{commands}; done @end example + Expand @var{words}, and execute @var{commands} once for each member in the resultant list, with @var{name} bound to the current member. If @samp{in @var{words}} is not present, the @code{for} command @@ -813,6 +817,7 @@ @example for (( @var{expr1} ; @var{expr2} ; @var{expr3} )) ; do @var{commands} ; done @end example + First, the arithmetic expression @var{expr1} is evaluated according to the rules described below (@pxref{Shell Arithmetic}). The arithmetic expression @var{expr2} is then evaluated repeatedly @@ -822,7 +827,6 @@ If any expression is omitted, it behaves as if it evaluates to 1. The return value is the exit status of the last command in @var{commands} that is executed, or false if any of the expressions is invalid. - @end table The @code{break} and @code{continue} builtins (@pxref{Bourne Shell Builtins}) @@ -869,7 +873,7 @@ The syntax of the @code{case} command is: @example -@code{case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} esac} +case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} esac @end example @code{case} will selectively execute the @var{command-list} corresponding to @@ -1048,11 +1052,11 @@ @item @var{expression1} || @var{expression2} True if either @var{expression1} or @var{expression2} is true. @end table + @noindent The @code{&&} and @code{||} operators do not evaluate @var{expression2} if the value of @var{expression1} is sufficient to determine the return value of the entire conditional expression. - @end table @node Command Grouping @@ -1103,7 +1107,7 @@ @subsection Coprocesses @cindex coprocess -A @code{coprocess} is a shell command preceded by the @code{coproc} +A coprocess is a shell command preceded by the @code{coproc} reserved word. A coprocess is executed asynchronously in a subshell, as if the command had been terminated with the @samp{&} control operator, with a two-way pipe @@ -1111,7 +1115,7 @@ The format for a coprocess is: @example -@code{coproc} [@var{NAME}] @var{command} [@var{redirections}] +coproc [@var{NAME}] @var{command} [@var{redirections}] @end example @noindent @@ -1121,22 +1125,22 @@ command (@pxref{Simple Commands}); otherwise, it is interpreted as the first word of the simple command. -When the coproc is executed, the shell creates an array variable +When the coprocess is executed, the shell creates an array variable (@pxref{Arrays}) -named @var{NAME} in the context of the executing shell. +named @env{NAME} in the context of the executing shell. The standard output of @var{command} is connected via a pipe to a file descriptor in the executing shell, -and that file descriptor is assigned to @var{NAME}[0]. +and that file descriptor is assigned to @env{NAME[0]}. The standard input of @var{command} is connected via a pipe to a file descriptor in the executing shell, -and that file descriptor is assigned to @var{NAME}[1]. +and that file descriptor is assigned to @env{NAME[1]}. This pipe is established before any redirections specified by the command (@pxref{Redirections}). The file descriptors can be utilized as arguments to shell commands and redirections using standard word expansions. The process ID of the shell spawned to execute the coprocess is -available as the value of the variable @var{NAME}_PID. +available as the value of the variable @env{NAME_PID}. The @code{wait} builtin command may be used to wait for the coprocess to terminate. @@ -1232,9 +1236,15 @@ Functions are declared using this syntax: @rwindex function + +@example +@var{name} () @var{compound-command} [ @var{redirections} ] +@end example + +or: + @example -@var{name} () @var{compound-command} [ @var{redirections} ]@*or@* -@code{function} @var{name} [()] @var{compound-command} [ @var{redirections} ] +function @var{name} [()] @var{compound-command} [ @var{redirections} ] @end example This defines a shell function named @var{name}. The reserved @@ -1314,9 +1324,9 @@ the function and the commands it invokes. Function names and definitions may be listed with the -@option{-f} option to the @code{declare} or @code{typeset} -builtin commands (@pxref{Bash Builtins}). -The @option{-F} option to @code{declare} or @code{typeset} +@option{-f} option to the @code{declare} +builtin command (@pxref{Bash Builtins}). +The @option{-F} option to @code{declare} will list the function names only (and optionally the source file and line number, if the @code{extdebug} shell option is enabled). @@ -1374,8 +1384,7 @@ of @code{"$@@"} as explained below. Filename expansion is not performed. Assignment statements may also appear as arguments to the -@code{alias}, -@code{declare}, @code{typeset}, @code{export}, @code{readonly}, +@code{alias}, @code{declare}, @code{export}, @code{readonly}, and @code{local} builtin commands. In the context where an assignment statement is assigning a value @@ -1498,6 +1507,7 @@ Expansion is performed on the command line after it has been split into @code{token}s. There are seven kinds of expansion performed: + @itemize @bullet @item brace expansion @item tilde expansion @@ -2044,7 +2054,7 @@ If one of these characters appears, then the word is regarded as a @var{pattern}, and replaced with an alphabetically sorted list of -file names matching the pattern. If no matching file names are found, +file names matching the pattern. If no matching file names are found, and the shell option @code{nullglob} is disabled, the word is left unchanged. If the @code{nullglob} option is set, and no matches are found, the word @@ -2714,7 +2724,7 @@ @var{waitpid} system call or equivalent function. Exit statuses fall between 0 and 255, though, as explained below, the shell may use values above 125 specially. Exit statuses from shell builtins and -compound commands are also limited to this range. Under certain +compound commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes. @@ -3192,6 +3202,9 @@ @itemx [ @btindex test @btindex [ +@example +test @var{expr} +@end example Evaluate a conditional expression @var{expr}. Each operator and operand must be a separate argument. Expressions are composed of the primaries described below in @@ -3379,7 +3392,7 @@ @item alias @btindex alias @example -alias [@code{-p}] [@var{name}[=@var{value}] @dots{}] +alias [-p] [@var{name}[=@var{value}] @dots{}] @end example Without arguments or with the @option{-p} option, @code{alias} prints @@ -3541,7 +3554,7 @@ @item declare @btindex declare @example -declare [-aAfFilrtux] [-p] [@var{name}[=@var{value}] @dots{}] +declare [-aAfFgilrtux] [-p] [@var{name}[=@var{value}] @dots{}] @end example Declare variables and give them attributes. If no @var{name}s @@ -3618,7 +3631,7 @@ may not be used to destroy an array variable and @samp{+r} will not remove the readonly attribute. When used in a function, @code{declare} makes each @var{name} local, -as with the @code{local} command, unless the @samp{-g} option is used. +as with the @code{local} command, unless the @option{-g} option is used. If a variable name is followed by =@var{value}, the value of the variable is set to @var{value}. @@ -3745,7 +3758,7 @@ @item let @btindex let @example -let @var{expression} [@var{expression}] +let @var{expression} [@var{expression} @dots{}] @end example The @code{let} builtin allows arithmetic to be performed on shell variables. Each @var{expression} is evaluated according to the @@ -3778,14 +3791,15 @@ @item mapfile @btindex mapfile @example -mapfile [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] [ --C @var{callback}] [-c @var{quantum}] [@var{array}] +mapfile [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] + [-C @var{callback}] [-c @var{quantum}] [@var{array}] @end example Read lines from the standard input into the indexed array variable @var{array}, or from file descriptor @var{fd} if the @option{-u} option is supplied. The variable @code{MAPFILE} is the default @var{array}. Options, if supplied, have the following meanings: + @table @code @item -n @@ -3841,16 +3855,16 @@ @table @code @item %b -causes @code{printf} to expand backslash escape sequences in the -corresponding @var{argument}, -(except that @samp{\c} terminates output, backslashes in +Causes @code{printf} to expand backslash escape sequences in the +corresponding @var{argument}; +except that @samp{\c} terminates output, backslashes in @samp{\'}, @samp{\"}, and @samp{\?} are not removed, and octal escapes -beginning with @samp{\0} may contain up to four digits). +beginning with @samp{\0} may contain up to four digits. @item %q -causes @code{printf} to output the +Causes @code{printf} to output the corresponding @var{argument} in a format that can be reused as shell input. @item %(@var{datefmt})T -causes @code{printf} to output the date-time string resulting from using +Causes @code{printf} to output the date-time string resulting from using @var{datefmt} as a format string for @code{strftime}(3). The corresponding @var{argument} is an integer representing the number of seconds since the epoch. Two special argument values may be used: -1 represents the current @@ -3872,7 +3886,8 @@ @item read @btindex read @example -read [-ers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}] [-N @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}] +read [-ers] [-a @var{aname}] [-d @var{delim}] [-i @var{text}] [-n @var{nchars}] + [-N @var{nchars}] [-p @var{prompt}] [-t @var{timeout}] [-u @var{fd}] [@var{name} @dots{}] @end example One line is read from the standard input, or from the file descriptor @var{fd} supplied as an argument to the @option{-u} option, and the first word @@ -3955,14 +3970,13 @@ @item -u @var{fd} Read input from file descriptor @var{fd}. - @end table @item readarray @btindex readarray @example -readarray [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] [ --C @var{callback}] [-c @var{quantum}] [@var{array}] +readarray [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] + [-C @var{callback}] [-c @var{quantum}] [@var{array}] @end example Read lines from the standard input into the indexed array variable @var{array}, or from file descriptor @var{fd} @@ -4017,11 +4031,10 @@ @item typeset @btindex typeset @example -typeset [-afFrxi] [-p] [@var{name}[=@var{value}] @dots{}] +typeset [-aAfFgilrtux] [-p] [@var{name}[=@var{value}] @dots{}] @end example -The @code{typeset} command is supplied for compatibility with the Korn -shell; however, it has been deprecated in favor of the @code{declare} -builtin command. +A deprecated synonym of the @code{declare} builtin command. +It is supplied for compatibility with the Korn shell. @item ulimit @btindex ulimit @@ -4031,6 +4044,7 @@ @code{ulimit} provides control over the resources available to processes started by the shell, on systems that allow such control. If an option is given, it is interpreted as follows: + @table @code @item -S Change and report the soft limit associated with a resource. @@ -4096,7 +4110,6 @@ @item -T The maximum number of threads. - @end table If @var{limit} is given, it is the new value of the specified resource; @@ -4126,7 +4139,6 @@ Remove each @var{name} from the list of aliases. If @option{-a} is supplied, all aliases are removed. Aliases are described in @ref{Aliases}. - @end table @node Modifying Shell Behavior @@ -4313,9 +4325,9 @@ and the @env{SHELLOPTS}, @env{BASHOPTS}, @env{CDPATH} and @env{GLOBIGNORE} 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 @code{-p} option is not supplied, these actions +real user (group) id, and the @option{-p} option is not supplied, these actions are taken and the effective user id is set to the real user id. -If the @code{-p} option is supplied at startup, the effective user id is +If the @option{-p} 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. @@ -5754,12 +5766,12 @@ @subsubheading Invoked with unequal effective and real @sc{uid/gid}s If Bash is started with the effective user (group) id not equal to the -real user (group) id, and the @code{-p} option is not supplied, no startup +real user (group) id, and the @option{-p} option is not supplied, no startup files are read, shell functions are not inherited from the environment, the @env{SHELLOPTS}, @env{BASHOPTS}, @env{CDPATH}, and @env{GLOBIGNORE} variables, if they appear in the environment, are ignored, and the effective user id is set to the real user id. -If the @code{-p} option is supplied at invocation, the startup behavior is +If the @option{-p} option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset. @node Interactive Shells @@ -6186,7 +6198,7 @@ is not expanded a second time. This means that one may alias @code{ls} to @code{"ls -F"}, for instance, and Bash does not try to recursively expand the -replacement text. If the last character of the alias value is a +replacement text. If the last character of the alias value is a space or tab character, then the next command word following the alias is also checked for alias expansion. @@ -6935,7 +6947,7 @@ 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, @samp{%ce} refers -to a stopped @code{ce} job. Using @samp{%?ce}, on the +to a stopped @code{ce} job. Using @samp{%?ce}, on the other hand, refers to any job containing the string @samp{ce} in its command line. If the prefix or substring matches more than one job, Bash reports an error. @@ -7969,7 +7981,7 @@ builtin (@pxref{The Set Builtin}). @item -The @samp{-x} (@code{xtrace}) option displays commands other than +The @option{-x} (@option{xtrace}) option displays commands other than simple commands when performing an execution trace (@pxref{The Set Builtin}).