This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.
Last Updated: 2025-11-04
How to do math in Unix command line?
Best way is $(( 2 + 2 ))- note the double parentheses.
This is better than expr, which is outdated.