This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 60fa280715c15c67216a432ef5d81539f7527b69 Author: Junbo Zheng <zhengjun...@xiaomi.com> AuthorDate: Mon Jan 29 19:32:58 2024 +0800 Documentation: add `expr` command description Reference: https://github.com/apache/nuttx-apps/pull/2268 Signed-off-by: Junbo Zheng <zhengjun...@xiaomi.com> --- Documentation/applications/nsh/commands.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/applications/nsh/commands.rst b/Documentation/applications/nsh/commands.rst index 1f97661bd6..834daf8e8f 100644 --- a/Documentation/applications/nsh/commands.rst +++ b/Documentation/applications/nsh/commands.rst @@ -503,6 +503,34 @@ examples: The ``export`` command is not supported by NSH unless both ``CONFIG_NSH_VARS=y`` and ``CONFIG_DISABLE_ENVIRON``\ is not set. +.. _cmdexpr: + +``expr`` Evaluate expressions +============================= + +**Command Syntax**:: + + expr <operand1> <operator> <operand2> + +**Synopsis**. It is a mini version for the expr command, which implements the +features of addition, subtraction, multiplication, division and mod. + +**Examples**: + + nsh> expr 5 - 2 + 3 + nsh> set hello 10 + nsh> expr $hello - 2 + 8 + nsh> expr 8 a 9 + Unknown operator + nsh> expr 20 / 5 + 4 + nsh> expr 10 % 4 + 2 + nsh> expr 100 + 0 + 100 + .. _cmdfree: ``free`` Show Memory Manager Status