Junbo Zheng c699b05f74 nshlib: add expr command support
It is a mini version for the `expr` command, which implements the features of addition, subtraction, multiplication, division and mod.

Reference: https://www.geeksforgeeks.org/expr-command-in-linux-with-examples/

bl2>
bl2> expr 1 + 2
3
bl2> expr
Usage: expr <operand1> <operator> <operand2>
bl2> expr 5 - 2
3
bl2> set hello 10
bl2> expr $hello - 2
8
bl2> expr 8 a 9
Unknown operator
bl2> expr 20 / 5
4
bl2> expr 10 % 4
2
bl2> expr 10 / 0
operand2 invalid
bl2>
bl2> expr mi + 100
invalid parameter
bl2> expr 100 + mi
invalid parameter
bl2> expr 100 + 0
100

Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
2024-01-25 18:12:28 -08:00
..
2024-01-25 18:12:28 -08:00
2023-09-21 10:48:29 +08:00
2024-01-25 18:12:28 -08:00
2023-12-14 20:14:25 -08:00
2023-05-08 21:35:16 +03:00
2023-08-01 08:13:23 -07:00
2023-05-08 21:35:16 +03:00