In the Linux system the expr command used for performing arithmetic, regular expressions and string operations. In short and technically it prints the value of Expression to standard output.
expr Command with Examples:
Open the terminal (ctrl+alt+t) application and run below commands.
1. Arithmetic Operations Using expr Command
Addition:
expr 15 + 9
Subtraction:
expr 15 - 9
Multiplication:
expr 15 \* 9
Division:
expr 100 / 10
2. Comparison – Check if a number is greater than another number or not.
expr 15 \> 9
expr 15 \< 9
The result value 1 indicates the first number is greater than the second one. Whereas, the result value 0 indicates the first number is not greater than the second one.
For the complete expr command details run below commands.
man expr
expr --h