[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.
This commit is contained in:
Fabian Homborg 2018-02-07 01:01:18 +01:00
parent aa31fb92f2
commit 50bec2c32e

View file

@ -450,6 +450,22 @@ else
end
\endfish
To check string, number or file properties, use <a href="commands.html#test">test</a>, 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
<a href="#tut_combiners">Combiners</a> can also be used to make more complex conditions, like
\fish