On Thu, Jan 23, 2025 at 18:15:38 -0800, Keith Thompson wrote: > $[...] appears to behave like $((...)). Is it equivalent?
It was the proposed syntax for arithmetic in a POSIX draft a couple decades ago. Bash implemented it, and it started to catch on. But then POSIX went with $(( )) instead. $[ was deprecated years ago, and removed from the manuals, but it's still there for compatibility with scripts that were written when it was still a supported syntax. I actually wish $[ had won the battle, because $( and $(( have some parsing ambiguities that crop up from time to time.