((...)): Difference between revisions
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
* [[Bash_Concepts#.28.28....29.29|Bash Concepts]] | * [[Bash_Concepts#.28.28....29.29|Bash Concepts]] | ||
* [[Numbers_and_Arithmetic_in_bash|Numbers and Arithmetic in bash]] | * [[Numbers_and_Arithmetic_in_bash|Numbers and Arithmetic in bash]] | ||
* [[Bash_%2B%3D_and_-%3D|+= and -=]] | |||
=Increment an Integer= | =Increment an Integer= |
Latest revision as of 05:35, 8 May 2020
Internal
Increment an Integer
local i=0
((i++))
Decrement an Integer
local i=1
((i--))
Organizatorium
Display the value of the variable, then increment it:
i=0
echo $((i++))
echo ${i}
displays:
0
1
Increment the value of a variable, then display t:
i=0
echo $((++i))
echo ${i}
displays:
1
1