How Do You Multiply a Shell Script in Linux?
Contents

How do you perform a multiplication in shell script?

Multiplication of two numbers using expr in shell script

In shell, * represents all files in the current directory. So, in order to use * as a multiplication operator, we should escape it like *. If we directly use * in expr, we will get error message.

How do you multiply in bash?

The Bash shell has a large list of supported arithmetic operators to do math calculations.
…
What are the Bash Arithmetic Operators?

Arithmetic Operator Description
** exponentiation
*, /, % multiplication, division, remainder (modulo)
+, – addition, subtraction
«, » left and right bitwise shifts
David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest