From this post I learned that :
can be used to get the side effects of a parameter expansion. I stumbled upon this code which uses a parameter expansion that looks new to me:
$ R=32; : $[R--]; echo $R
31
Here : $[R--]
seems to be equivalent to ((R--))
. What is $[]
? And is it documented in man bash(1)
? I couldn't find it on the man pages.
$[...]
would be removed in a future version, but now I can't find it. (@steeldriver, did you quote that from somewhere in a comment?) It still seems to work in Bash 5.0, so apparently we're not far enough in the future yet. :) – ilkkachu Nov 11 '19 at 19:19man bash
(version 4.4.20(1)-release) underArithmetic Expansion
– steeldriver Nov 11 '19 at 19:41