From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21653 invoked from network); 5 Oct 2002 17:31:46 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 5 Oct 2002 17:31:46 -0000 Received: (qmail 25177 invoked by alias); 5 Oct 2002 17:31:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17773 Received: (qmail 25163 invoked from network); 5 Oct 2002 17:31:37 -0000 Date: Sat, 5 Oct 2002 13:31:25 -0400 From: Clint Adams To: zsh-workers@sunsite.dk Cc: 163391-forwarded@bugs.debian.org Subject: [doogie@debian.org: Bug#163391: unset array[key] where key is non-existent doesn't fail] Message-ID: <20021005173125.GA24695@dman.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-milter (http://amavis.org/) I'm not sure to what "contract" he's referring, but SUSv3 says Unsetting a variable or function that was not previously set shall not be considered an error and does not cause the shell to abort. and that unset should return a >0 exit status if any of the "name" operands cannot be unset. Of course, it knows nothing about associative arrays. ----- Forwarded message from Adam Heath ----- bash-2.05b$ zsh -c 'unset non_existant_var && echo error || echo correct; unset "array[1]" && echo error || echo correct; declare -A aarray; unset "aarray[foo]" && echo error || echo correct' correct correct error The contract for unset says that if the variable being unset doesn't exist, an error is returned. As shown above, variables and normal arrays behave as expected, but associative arrays do not. ----- End forwarded message -----