From 6e7d497a52750808cbfcface72c6b5b17604b192 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 26 Jul 2021 21:31:57 +0200 Subject: [PATCH] docs: Add a note explaining `test` --- doc_src/language.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc_src/language.rst b/doc_src/language.rst index b84280e36..6070d42e5 100644 --- a/doc_src/language.rst +++ b/doc_src/language.rst @@ -360,6 +360,12 @@ The other conditionals use the :ref:`exit status ` of a comman Unlike programming languages you might know, :ref:`if ` doesn't take a *condition*, it takes a *command*. If that command returned a successful :ref:`exit status ` (that's 0), the ``if`` branch is taken, otherwise the :ref:`else ` branch. +To check a condition, there is the :ref:`test ` command:: + + if test 5 -gt 2 + echo Yes, five is greater than two + end + Some examples:: # Just see if the file contains the string "fish" anywhere.