diff options
Diffstat (limited to 'doc_src/if.txt')
-rw-r--r-- | doc_src/if.txt | 7 |
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 |