Bash variables hold strings, numbers, paths, and command results. Arithmetic expansion lets a script calculate with integer values.

Program

Play the script to watch named values build a small checkout total step by step.

variables.sh
#!/usr/bin/env bash

price=18
quantity=3
subtotal=$((price * quantity))
discount=5
total=$((subtotal - discount))
echo "total=$total"
assignment An assignment stores text in a shell variable with no spaces around `=`.
arithmetic expansion `$((...))` evaluates integer arithmetic before assignment.