The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: arnold@skeeve.com
To: tuhs@minnie.tuhs.org, msi@malbolge.net
Subject: Re: [TUHS] Arithmetic expansion in Unix shells
Date: Mon, 21 Jun 2021 03:57:51 -0600	[thread overview]
Message-ID: <202106210957.15L9vpZu004496@freefriends.org> (raw)
In-Reply-To: <20210621113752.110edede@moon>

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@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

  reply	other threads:[~2021-06-21  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  9:37 Michael Siegel
2021-06-21  9:57 ` arnold [this message]
2021-06-21 13:50   ` Chet Ramey
2021-06-21 14:43     ` Michael Siegel
2021-06-21 14:48       ` Chet Ramey
2021-06-22 16:24         ` Michael Siegel
2021-06-22 15:52 Brian Walden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202106210957.15L9vpZu004496@freefriends.org \
    --to=arnold@skeeve.com \
    --cc=msi@malbolge.net \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).