Re: status on $[arith] for eval arith vsl $((arith))??
From:
Maarten Billemont
Subject:
Re: status on $[arith] for eval arith vsl $((arith))??
Date:
Sun, 8 Apr 2012 21:02:52 +0200
On 08 Apr 2012, at 01:47, Chet Ramey wrote:
> On 4/7/12 4:45 PM, Linda Walsh wrote:
>>
>>
>>
>> In modifying some released code on my distro, I ran into the extensive use
>> of $[arith] as a means for returning arithmetic evaluations of the
>> expression.
>>
>> I vaguely remember something like that from years ago, but never see any
>> reference to
>> it -- yet it works, and old code seems to rely on it -- and
>> "$[(1+2)/3]" looks cleaner than "$(((1+2)/3))". So what's up with that?
>
> It dates from Posix circa 1990 (1003.2d9, of which I've lost my paper
> copy). I implemented it after the Berkeley guys, mostly Marc
> Teitelbaum, put it into Posix. It ended up getting dropped in favor
> of the ksh $((...)) expansion, at which point everyone deprecated the
> old $[...]. I removed it from the manual sometime later, but it still
> works as it always has.
>
> Chet
Any particular reason for not removing old undocumented functionality, or is
that mostly the nature of this beast - dragging along and maintaining ancient
code for the sake of compatibility?