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?

If it wasn't designed to run in non-bash environments, I might think it was
an artifact of array evaluation.. I.e. with no array name after $, instead of that number being used as an index for the array, it's returned as a raw value... but
I've seen it in code designed for 'sh'...

Is it an accidental omission from the bash manpage?






Reply via email to