[TUHS] Arithmetic expansion in Unix shells

arnold at skeeve.com arnold at skeeve.com
Mon Jun 21 19:57:51 AEST 2021


Arithmetic expansion dates back at least as far as ksh88.
Bash likely picked it up from there.

The original was only integer math and Bash remains that way (IIRC,
Chet can correct me if I'm wrong). ksh93 added floating point math.

POSIX would have picked it up from ksh88.

HTH,

Arnold

Michael Siegel <msi at malbolge.net> wrote:

> Hello,
>
> I'm currently trying out the rc shell (using Byron Rakitzis'
> implementation for Unix). Compared to Bash, which I normally use, this
> shell has a rather small feature set (which isn't to say that that's
> necessarily a bad thing).
>
> Now, one of the features that Bash has and rc doesn't have is the
> ability to perform arithmetic expansion. That's not really a problem
> because you can just use `expr` instead. I wonder, though, when
> arithmetic expansion as a shell built-in became a thing, especially in
> POSIX sh.
>
> POSIX has included that feature since at least 2001, and probably quite
> some years earlier, given that Bash already had it in 1995 (going by
> the manual page of version 1.14.7, the oldest I could find).
>
> So, maybe someone here can help me find out when this was actually
> standardized.
>
> Thanks.
>
> --
> Michael


More information about the TUHS mailing list