mirror of
https://github.com/flokoe/bash-hackers-wiki.git
synced 2024-11-01 14:53:06 +01:00
25 lines
1004 B
Plaintext
25 lines
1004 B
Plaintext
|
====== Arithmetic evaluation (command) ======
|
||
|
|
||
|
===== Synopsis =====
|
||
|
<code>
|
||
|
(( <EXPRESSION> ))
|
||
|
</code>
|
||
|
|
||
|
===== Description =====
|
||
|
This command evaluates the [[syntax:arith_expr | arithmetic expression]] ''<EXPRESSION>''.
|
||
|
|
||
|
If the expression evaluates to 0 then the exit code of the expression is set to 1 (''FALSE''). If the expression evaluates to something else than 0, then the exit code of the expression is set to 0 (''TRUE''). For this return code mapping, please see [[syntax:arith_expr#arithmetic_expressions_and_return_codes | this section]].
|
||
|
|
||
|
|
||
|
The functionality basically is equivalent to what the [[commands:builtin:let | ''let'' builtin command]] does. The arithmetic evaluation compound command should be preferred.
|
||
|
|
||
|
===== Examples =====
|
||
|
|
||
|
|
||
|
===== Portability considerations =====
|
||
|
|
||
|
===== See also =====
|
||
|
* Internal: [[syntax:arith_expr | arithmetic expressions]]
|
||
|
* Internal: [[syntax:expansion:arith | arithmetic expansion]]
|
||
|
* Internal: [[commands:builtin:let | The ''let'' builtin command]]
|