construct

Bash arithmetic command

Evaluates arithmetic as a command; nonzero result gives exit status 0, zero gives 1.

Formal Syntax & Structure

bash syntaxbash
(( expression ))

Return Value

exit status

Evaluates arithmetic as a command; nonzero result gives exit status 0, zero gives 1.

Working Example

Example Snippetbash
count=0(( count++ ))status=$?printf '%s %s\n' "$count" "$status"count=0(( ++count ))status=$?printf '%s %s\n' "$count" "$status"
Bash Reference