aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/if.txt
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-05-19 13:00:40 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-05-19 13:03:06 -0700
commitade6ebf5226e67aa5d5fa64ad56921d69f03f4e9 (patch)
treead512f50284d3c1e85d3b97de0bb1b10297f2450 /doc_src/if.txt
parent768277a312e1f91248d00d80af814d2c6721dc85 (diff)
Update docs to reflect new if/while condtion chaining
Documents new behavior in #1428 Cherry picked from 30ea7cc3f8a5d56ad30dc749ea374363c15f312a
Diffstat (limited to 'doc_src/if.txt')
-rw-r--r--doc_src/if.txt7
1 files changed, 3 insertions, 4 deletions
diff --git a/doc_src/if.txt b/doc_src/if.txt
index 1cecdcd3..a30b1011 100644
--- a/doc_src/if.txt
+++ b/doc_src/if.txt
@@ -12,7 +12,7 @@ end
`if` will execute the command `CONDITION`. If the condition's exit status is 0, the commands `COMMANDS_TRUE` will execute. If the exit status is not 0 and `else` is given, `COMMANDS_FALSE` will be executed.
-In order to use the exit status of multiple commands as the condition of an if block, use <a href="#begin">`begin; ...; end`</a> and the short circuit commands <a href="commands.html#and">`and`</a> and <a href="commands.html#or">`or`</a>.
+You can use <a href="#and">`and`</a> or <a href="#and">`or`</a> in the condition. See the second example below.
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.
@@ -33,9 +33,8 @@ end
The following code will print "foo.txt exists and is readable" if foo.txt is a regular file and readable
\fish
-if begin test -f foo.txt
- and test -r foo.txt
- end
+if test -f foo.txt
+ and test -r foo.txt
echo "foo.txt exists and is readable"
end
\endfish