((...))

From NovaOrdis Knowledge Base
Revision as of 05:35, 8 May 2020 by Ovidiu (talk | contribs) (→‎Internal)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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