blob: 6634f237b834ff4607370fa5e8192e4b14f1af26 (
plain)
1
2
3
4
5
6
7
8
|
<h1 class="subsection">Arithmetic Expansion</h1> <p>Arithmetic expansion allows the evaluation of an arithmetic expression and the substitution of the result. The format for arithmetic expansion is: </p> <div class="example"> <pre class="example">$(( expression ))
</pre>
</div> <p>The <var>expression</var> undergoes the same expansions as if it were within double quotes, but double quote characters in <var>expression</var> are not treated specially and are removed. All tokens in the expression undergo parameter and variable expansion, command substitution, and quote removal. The result is treated as the arithmetic expression to be evaluated. Arithmetic expansions may be nested. </p> <p>The evaluation is performed according to the rules listed below (see <a href="shell-arithmetic">Shell Arithmetic</a>). If the expression is invalid, Bash prints a message indicating failure to the standard error and no substitution occurs. </p><div class="_attribution">
<p class="_attribution-p">
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
<a href="https://www.gnu.org/software/bash/manual/html_node/Arithmetic-Expansion.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Arithmetic-Expansion.html</a>
</p>
</div>
|