mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
[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:
parent
aa31fb92f2
commit
50bec2c32e
1 changed files with 16 additions and 0 deletions
|
@ -450,6 +450,22 @@ else
|
||||||
end
|
end
|
||||||
\endfish
|
\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
|
<a href="#tut_combiners">Combiners</a> can also be used to make more complex conditions, like
|
||||||
|
|
||||||
\fish
|
\fish
|
||||||
|
|
Loading…
Reference in a new issue