From e44e3d50dee26d12927baca188ad2a44a0135173 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 15 May 2023 13:30:18 -0400 Subject: complete initial implementation of nofork command substitution (${ command; }) --- doc/bash.html | 75 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 12 deletions(-) (limited to 'doc/bash.html') diff --git a/doc/bash.html b/doc/bash.html index b3738b57..287ac3a3 100644 --- a/doc/bash.html +++ b/doc/bash.html @@ -3,7 +3,7 @@ -
BASH(1)2023 April 17BASH(1) +BASH(1)2023 May 14BASH(1)

Index @@ -2869,8 +2869,10 @@ and which sort the files on name, file size, modification time, access time, inode change time, and number of blocks, respectively. -For example, a value of -mtime sorts the results in descending +For example, a value of -mtime sorts the results in descending order by modification time (newest first). +A sort specifier of nosort disables sorting completely; the results +are returned in the order they are read from the file system,. If the sort specifier is missing, it defaults to name, so a value of + is equivalent to the null string, and a value of - sorts by name in descending order. @@ -4463,16 +4465,17 @@ expansion as described below.

Command Substitution

Command substitution allows the output of a command to replace -the command name. There are two forms: +the command itself. +There are two standard forms:

$(command)

-or +or (deprecated)
-`command` +`command`.

@@ -4488,7 +4491,7 @@ The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

-When the old-style backquote form of substitution is used, +With the old-style backquote form of substitution, backslash retains its literal meaning except when followed by $, @@ -4503,12 +4506,60 @@ When using the $(command) form, all characters between the parentheses make up the command; none are treated specially.

+There is an alternate form of command substitution: +

+

+ +${C command;} +

+ +

+ +which executes command in the current execution environment. +This means that side effects of command take effect immediately +in the current execution environment and persist in the current +environment after the command completes (e.g., the exit builtin +will exit the shell). +

+ +The character C following the open brace must be a space, tab, +newline, (, or |, and the close brace must be in a position +where a reserved word may appear (i.e., preceded by a command terminator +such as semicolon). +Bash allows the close brace to be joined to the remaining characters in +the word without being followed by a shell metacharacter as a reserved +word would usually require. +

+ +This type of command substitution superficially resembles executing an +unnamed shell function: local variables are created as when a shell +function is executing, and the return builtin forces +command to complete; +however, the rest of the execution environment, +including the positional parameters, is shared with the caller. +

+ +If the first character following the open brace is a (, +command is executed in a subshell, and command must be +terminated by a ). This is similar to the ( compound +command (see Compound Commands above). +If the first character is a |, the construct expands to the +value of the REPLY shell variable after command executes, +without removing any trailing newlines, +and the standard output of command remains the same as in the +calling shell. +Bash creates REPLY as an initially-unset local variable when +command executes, and restores REPLY to the value it had +before the command substitution after command completes, +as with any local variable. +

+ 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 -pathname expansion are not performed on the results. +If the substitution appears within double quotes, bash does not perform +word splitting and pathname expansion on the results.  

Arithmetic Expansion

@@ -11999,7 +12050,7 @@ in the same way as echo -e.
causes printf to output the corresponding argument in a format that can be reused as shell input. -%q and %Q use the $'' quoting style if any characters +%q and %Q use the $aqaq quoting style if any characters in the argument string require it, and backslash quoting otherwise. If the format string uses the printf alternate form, these two formats quote the argument string using single quotes. @@ -14944,7 +14995,7 @@ There may be only one active coprocess at a time.
-
GNU Bash 5.22023 April 17BASH(1) +GNU Bash 5.22023 May 14BASH(1)

@@ -15050,7 +15101,7 @@ There may be only one active coprocess at a time.
BUGS

-This document was created by man2html from bash.1.
-Time: 18 April 2023 10:26:09 EDT +This document was created by man2html from /usr/local/src/bash/bash-20230509/doc/bash.1.
+Time: 14 May 2023 15:37:14 EDT -- cgit v1.2.1