((...)): Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 28: | Line 28: | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
0 | 0 | ||
1 | |||
</syntaxhighlight> | |||
Increment the value of a variable, then display t: | |||
<syntaxhighlight lang='bash'> | |||
i=0 | |||
echo $((++i)) | |||
echo ${i} | |||
</syntaxhighlight> | |||
displays: | |||
<syntaxhighlight lang='bash'> | |||
1 | |||
1 | 1 | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 01:43, 14 March 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