arithmetic-operator

Bash += assignment operator

Updates the variable using the arithmetic + operation and assignment. The expression yields the assigned value.

Formal Syntax & Structure

bash syntaxbash
(( n += value ))

Return Value

integer

Updates the variable using the arithmetic + operation and assignment. The expression yields the assigned value.

Working Example

Example Snippetbash
n=4(( n += 3 ))printf '%s\n' "$n"
Bash Reference