Bash += and -=: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 4: Line 4:
=Internal=
=Internal=
* [[Bash_Concepts#.2B.3D|bash Concepts]]
* [[Bash_Concepts#.2B.3D|bash Concepts]]
* [[((...))|((...))]]


=Overview=
=Overview=

Revision as of 05:34, 8 May 2020

External

Internal

Overview

+= and -= are assignment operators that can be used to increment/decrement the value of the left operand with the value specified after the operator. The operators can be used on integral values as such:

i=0
((i+=1))
echo ${i}

displays:

1

The += can be used on string values as such: