From 50bec2c32ea28b74edee585f4382e6ee7bd93013 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 7 Feb 2018 01:01:18 +0100 Subject: [PATCH] [docs] Add test example to tutorial As stated in https://stackoverflow.com/questions/48653771/fishshell-checking-equvalancy-like-does-in-most-languages, we didn't have one of those, and `test` is a relatively important part of plenty of `if`s. --- doc_src/tutorial.hdr | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc_src/tutorial.hdr b/doc_src/tutorial.hdr index c21277813..84e72cdba 100644 --- a/doc_src/tutorial.hdr +++ b/doc_src/tutorial.hdr @@ -450,6 +450,22 @@ else end \endfish +To check string, number or file properties, use test, like + +\fish{cli-dark} +if test "$fish" = "flounder" + echo FLOUNDER +end + +# or + +if test "$number" -gt 5 + echo $number is greater than five +else + echo $number is five or less +end +\endfish + Combiners can also be used to make more complex conditions, like \fish