• 𝘋𝘪𝘳𝘬@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    19 hours ago

    Yep! The functionality for performing arithmetic expressions this way is called “arithmetic expansion”.

    2.6.4 Arithmetic Expansion

    Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its value. The format for arithmetic expansion shall be as follows:

    $((expression))

    The expression shall be treated as if it were in double-quotes, except that a double-quote inside the expression is not treated specially. The shell shall expand all tokens in the expression for parameter expansion, command substitution, and quote removal.

    Next, the shell shall treat this as an arithmetic expression and substitute the value of the expression. […]

    https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_04