Clarify docs on $status with and/or/begin/end

See #4311.
This commit is contained in:
Fabian Homborg 2017-08-11 15:05:28 +02:00 committed by Kurtis Rader
parent 4e2b11f2e0
commit 298c580e72
4 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ COMMAND1; and COMMAND2
`and` statements may be used as part of the condition in an <a href="#if">`if`</a> or <a href="#while">`while`</a> block. See the documentation for <a href="#if">`if`</a> and <a href="#while">`while`</a> for examples. `and` statements may be used as part of the condition in an <a href="#if">`if`</a> or <a href="#while">`while`</a> block. See the documentation for <a href="#if">`if`</a> and <a href="#while">`while`</a> for examples.
`and` does not change the current exit status. The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable. `and` does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
\subsection and-example Example \subsection and-example Example

View file

@ -13,7 +13,7 @@ The block is unconditionally executed. `begin; ...; end` is equivalent to `if tr
`begin` is used to group a number of commands into a block. This allows the introduction of a new variable scope, redirection of the input or output of a set of commands as a group, or to specify precedence when using the conditional commands like `and`. `begin` is used to group a number of commands into a block. This allows the introduction of a new variable scope, redirection of the input or output of a set of commands as a group, or to specify precedence when using the conditional commands like `and`.
`begin` does not change the current exit status. `begin` does not change the current exit status itself. After the block has completed, `$status` will be set to the status returned by the most recent command.
\subsection begin-example Example \subsection begin-example Example

View file

@ -16,4 +16,4 @@ switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
For more information, read the For more information, read the
documentation for the block constructs, such as `if`, `for` and `while`. documentation for the block constructs, such as `if`, `for` and `while`.
The `end` command does not change the current exit status. The `end` command does not change the current exit status. Instead, the status after it will be the status returned by the most recent command.

View file

@ -12,7 +12,7 @@ COMMAND1; or COMMAND2
`or` statements may be used as part of the condition in an <a href="#if">`and`</a> or <a href="#while">`while`</a> block. See the documentation `or` statements may be used as part of the condition in an <a href="#if">`and`</a> or <a href="#while">`while`</a> block. See the documentation
for <a href="#if">`if`</a> and <a href="#while">`while`</a> for examples. for <a href="#if">`if`</a> and <a href="#while">`while`</a> for examples.
`or` does not change the current exit status. The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable. `or` does not change the current exit status itself, but the command it runs most likely will. The exit status of the last foreground command to exit can always be accessed using the <a href="index.html#variables-status">$status</a> variable.
\subsection or-example Example \subsection or-example Example