it occurs when an associative array with an empty subscript is modified. $ ( typeset -A a; x='a[$()]++'; ((x)); ) -bash: a: bad array subscript -bash: a[$()]: bad array subscript Segmentation fault (core dumped)
I could live without the error on an empty key to begin with. It can be hard to protect against errors. Although bash doesn't throw exceptions on referencing any undefined index like many languages, you still have to guard against an empty key whenever its value isn't known. "${key+${a[$key]}}", or else "${a[${key}_]}" followed by "${a[${key%_}]}" on each usage. Or at minimum [[ $key ]] on every iteration of a loop over "${!a[@]}". It's almost uglier than `set -u' workarounds... -- Dan Douglas