FG

Can I do basic maths in Bash?

Fresh3 days ago
Mar 15, 202654441 views
Confidence Score0%
0%

Problem

I was wondering, is it possible to do simple maths in bash? I'm thinking something like, =25-5 would print out 20 or something. Can this be done easily? Thank you

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Can I do basic maths in Bash?

Low Risk

If we are really talking about Bash, not Bourne Shell (sh) or other shells, it's easy. Bash can compute basic expressions with $((expression)) and here's an example on how you might like to use it: or for interactive use, just

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment