[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

status on $[arith] for eval arith vsl $((arith))??

From: Linda Walsh
Subject: status on $[arith] for eval arith vsl $((arith))??
Date: Sat, 07 Apr 2012 13:45:55 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/20100228 Lightning/0.9 Thunderbird/ Mnenhy/

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

[Prev in Thread] Current Thread [Next in Thread]