arithmetic-operator

Bash -- increment/decrement

Postfix yields the old value and updates the variable; prefix yields the updated value.

Formal Syntax & Structure

bash syntaxbash
(( count-- ))

Return Value

integer

Postfix yields the old value and updates the variable; prefix yields the updated value.

Working Example

Example Snippetbash
count=3old=$(( count-- ))printf '%s %s\n' "$old" "$count"
Bash Reference