On 8/27/25 12:29 PM, Stan Marsh wrote:

By the way - and completely changing the subject - but why do we have both $[] 
and
$(())?  They seem to be exactly the same.

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). I added
expression evaluation and $[...] to bash in mid-1990, but it didn't
appear in a release until bash-1.08 (May, 1991).

When POSIX.2 was published in 1992, there were already bash scripts using
$[...], so it stayed around. I wrote the first version of the bash man page
in mid-1990, and that documented the shell as it existed at the time, so
the question of whether or not it was documented is answerable.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to