Fix missing back single quotes and add if-then-else example

This commit is contained in:
Alan Carvalho de Assis 2023-01-12 18:20:53 -03:00 committed by Xiang Xiao
parent 6de5a862cd
commit 7677ec10dd

View File

@ -126,7 +126,7 @@ significant resources, they are disabled by default.
.. code-block:: bash
set FOO myprogram $BAR
set FOO `myprogram $BAR`
Will execute the program named ``myprogram`` passing it the
value of the environment variable ``BAR``. The value of the
@ -180,6 +180,16 @@ command success value of zero is treated true; a non-zero command
failure value is treated false. The ```test`` <#cmdtest>`__
command is frequently used for comparisons.
Examples:
.. code-block:: bash
nsh> if test 1 -eq 1; then echo "1 is equal 1"; else echo "1 is not equal 1"; fi
1 is equal 1
nsh> if test 1 -eq 0; then echo "1 is equal 0"; else echo "1 is not equal 0"; fi
1 is not equal 0
Looping
*******