Taylor Hedberg wrote:
---You are using some unusual bash syntax that I've personally never seen before, and doesn't appear to be documented in the bash(1) man page.echo $[offset+${diffs[$[MaxLevel-level]]}]You are using `$[...]` to do arithmetic expansion, but this is not the documented syntax for arithmetic expansion.
Me too until this last summer, when (()) intro'd some incompats in the 4.1 & 4.2 versions
from prior ones. I found the $[] usage, worked and as it didn't seem to be a 'bash-ism',
but an older syntax, I felt it might be more stable...
According to the man page, you should use `$((...))` for this, and indeed, that's the only way I've ever seen it. A quick Google search revealed that the syntax with square brackets is an old, deprecated form that should no longer be used. If you instead use the documented syntax on line 15, the strange highlighting goes away.
I reported the incompatibilities as bugs and was thoroughly derided...
As for the red flagging...
I thought it was for syntax errors? since it isn't a syntax error, but merely an older standard, shouldn't
it not be flagged as illegal?
No comments:
Post a Comment