On Thu, Mar 11, 2021 at 09:38:37AM -0700, Jason A. Donenfeld wrote:
> Single quotes with the nested double quote? That's nuts. But okay. I
> guess there really is some double expansion eval-like logic happening
> with the unset operator.

I removed the double quotes, as they serve no purpose there.

For an indexed array, use:      unset 'a[i]'
For an associative array, use:  unset 'a[$i]'

In both cases, use single quotes, and all will be well.

(In the indexed array case, there is another pitfall involving code
injection in the arithmetic context, so only use sanitized index values.)

Reply via email to