From 298c580e723cb183bf5e9c6aca3f4094d72a2e55 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 11 Aug 2017 15:05:28 +0200 Subject: [PATCH] Clarify docs on $status with and/or/begin/end See #4311. --- doc_src/and.txt | 2 +- doc_src/begin.txt | 2 +- doc_src/end.txt | 2 +- doc_src/or.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc_src/and.txt b/doc_src/and.txt index ed56da62d..2670a35e1 100644 --- a/doc_src/and.txt +++ b/doc_src/and.txt @@ -11,7 +11,7 @@ COMMAND1; and COMMAND2 `and` statements may be used as part of the condition in an `if` or `while` block. See the documentation for `if` and `while` 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 $status 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 $status variable. \subsection and-example Example diff --git a/doc_src/begin.txt b/doc_src/begin.txt index 6d18a6061..374fc78ce 100644 --- a/doc_src/begin.txt +++ b/doc_src/begin.txt @@ -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` 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 diff --git a/doc_src/end.txt b/doc_src/end.txt index 76cbe3603..2b035930c 100644 --- a/doc_src/end.txt +++ b/doc_src/end.txt @@ -16,4 +16,4 @@ switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end For more information, read the 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. diff --git a/doc_src/or.txt b/doc_src/or.txt index 97707e064..40b6bfcc7 100644 --- a/doc_src/or.txt +++ b/doc_src/or.txt @@ -12,7 +12,7 @@ COMMAND1; or COMMAND2 `or` statements may be used as part of the condition in an `and` or `while` block. See the documentation for `if` and `while` 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 $status 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 $status variable. \subsection or-example Example