Press "Enter" to skip to content

expr in Shell Script Multiplication Example


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 expression

expr Multiplication Example

To multiply using expr command use the \* operator. The following example will do multiplication by using the \* operator with expr command.

# Multiplication Example
# ---------- ---------
echo "Multiplication Example"
m=`expr 5 \* 3`
echo "5 * 3 = $m"


Multiplication Example
5 * 3 = 15

See also:

Vinish Kapoor

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *