Re: Is this a bug?

Perry Smith <[email protected]> Sun, 18 Jan 2026 10:06:08 -0600
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>
> On Jan 18, 2026, at 09:59, Mikael Magnusson <[email protected]> wrote:
> 
> On Sun, Jan 18, 2026 at 4:39 PM Perry Smith <[email protected] <mailto:[email protected]>> wrote:
>> 
>>> #!/bin/zsh
>>> 
>>> echo $ZSH_PATCHLEVEL
>>> echo $ZSH_VERSION
>>> A=( this is an arry of words )
>>> echo "${#A}"
>>> unset "A[-1]"
>>> echo "${#A}"
>> 
>> Result:
>> 
>>> zsh-5.9-0-g73d3173
>>> 5.9
>>> 6
>>> 6
>> 
>> I would expect the last echo to be only 5 instead of 6.
>> 
>> I’m writing a script.  I can easily cope with this but I thought I would mention it.
> 
> Unsetting a scalar sets it to the empty string, you probably rather want
> A[-1]=()

Thank you!
That works but from the manual I see:

>        To delete an element of an ordinary array, assign `()' to that element.
>        To delete an element of an associative array, use the unset command:
> 
>               unset "name[exp]"

Thank you for your time
pedz