((...))

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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