From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23757 invoked by alias); 1 Jul 2012 22:30:22 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30556 Received: (qmail 15299 invoked from network); 1 Jul 2012 22:30:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120701152908.ZM28654@torch.brasslantern.com> Date: Sun, 01 Jul 2012 15:29:08 -0700 In-reply-to: <20120701191526.50e2cf7d@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: PATCH Re: let unset array element remove compatible with bash" (Jul 1, 7:15pm) References: <120221210106.ZM13374@torch.brasslantern.com> <20120222095248.1ea8140b@pwslap01u.europe.root.pri> <120222092827.ZM24425@torch.brasslantern.com> <20120222201939.53899980@pws-pc.ntlworld.com> <120701095354.ZM28458@torch.brasslantern.com> <20120701191526.50e2cf7d@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Subject: Re: PATCH Re: let unset array element remove compatible with bash Cc: Daniel Lin MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jul 1, 7:15pm, Peter Stephenson wrote: } Subject: Re: PATCH Re: let unset array element remove compatible with bash } } On Sun, 01 Jul 2012 09:53:54 -0700 } Bart Schaefer wrote: } > So the patch below makes } > } > noglob unset foo[x] } > } > work properly. If x is an existing index (or valid slice), it is cut } > from the array as if by foo[x]=(). } } Do you mean that? For reference, the original question about this was users/16778, in which Daniel wrote: > $unset var[2] ###### BASH only delete one element > $var[2]=() ###### ZSH only delete one element so I made unset var[2] work like var[2]=(). On the other hand he also wrote: > $echo "${#var[@]} ${#var[1]} ${#var[2]} ${#var[3]}" > 2 4 0 14 so he is expecting var[2] to become an empty element that is not counted as part of the array, which zsh has no way to represent internally.