In Shell, expr is known as an all-purpose expression evaluator. Command expr concatenates and assesses the arguments according to the operation given. Operations may be arithmetic, comparison, string, or logical. This tutorial explains how to use expr in a shell script for multiplication with syntax and example.
expr Multiplication Example
To multiply using expr command use the \* operator. The following example will do multiplication by using the \* operator with expr command.
#!/bin/bash echo # Multiplication Example # ---------- --------- echo "Multiplication Example" echo m=`expr 5 \* 3` echo "5 * 3 = $m"
Multiplication Example 5 * 3 = 15