On Thu, 28 Aug 2025, 04:20 Chet Ramey, <chet.ra...@case.edu> wrote:

> It was in early drafts of POSIX.2 (1003.2-1992).
>
> The feature started out as the compound command ((expr)) (draft 8), evolved
> into a word expansion $[...] (draft 9), and then changed to $((...))
> (draft 11, the version I have was published in September, 1991).
>

In hindsight, that was an unfortunate decision by the POSIX committee,
creating a permanent mess parsing $((…)) as both command and numeric
substitutions, depending on what's inside, like $((…)…(…)) or $(((case
$thing in *$pattern) /bin/true & esac)).

What was the rationale for preferring $((…)) over $[…] back when they had a
free choice?

POSIX has a warning tor effect that writing a command substitution starting
with $(( is inadvisable, but not formally deprecated (in favour of $( (…))
with whitespace); would there be any appetite for issuing a formal
deprecation?

-Martin

Reply via email to