Shell Script Arithmetic and Conditional Testing
Arithmetic Operations
Script files must begin with #!/bin/bash. Comment are denoted by #. Code should be properly indented with whitespace.
Arithmetic operations support: +, -, *, /, **, %.
Evaluation methods:
# Method 1
let VAR=arithmetic-expression
# Method 2
VAR=$[arithmetic-expression]
# Method 3
VAR=$((arithmetic-expression))
# Method 4 ...
Posted on Fri, 22 May 2026 16:35:20 +0000 by stanleyg