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=6(( n &= 3 ))printf '%s\n' "$n"
Bash Reference