From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9662 invoked by alias); 12 Aug 2016 22:11:58 -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: 39034 Received: (qmail 11537 invoked from network); 12 Aug 2016 22:11:58 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.26):SA:0(0.0/5.0):. Processed in 0.112005 secs); 12 Aug 2016 22:11:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: vq@larryv.me X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.26 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=larryv.me; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=rtH eTFSAIhAZtj3bdymlp4F7Lec=; b=duZ/e/9nh4hwuaPDUF8zoFkffkPNxbqKzSc leZusb68OsjTCbH5HDCcMnWW60EcPiqGWVLUcK/hjC547Hqm3HjvNkYZm0jzqWKl Mt6uDheMfKGd1zZQkN36wi+c04MJzor5SZcUXPM+u2UmaRINpfh24h8A4aa2zPId g0acSxQ4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=rtHeTFSAIhAZtj3bdymlp4F7Lec=; b=R4V9c JebuqZ5fmYrCmQeQt1dvq5mGOvppxzAv0Wd44zOyxg2g9BcWqTYVO9NRCf0N4WSv rR4KH1zRhQcdKRuSt7ZnQM/bc6nxZN8X0YhXeXzFWCtZWjvVlz60H9Z115B42sdM OGyL2GUewO1sADa0KlgGfwZ85NkTTnIjHD+Nec= X-Sasl-enc: Redtkv3ui6GnWU8taYv+QmsNFOXh+Z2QrEamyNpWAD3P 1471039908 From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: ${#${(A)=name=word}} behavior depends on number of elements Message-Id: Date: Fri, 12 Aug 2016 18:11:47 -0400 To: zsh-workers@zsh.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) As I would expect, ${#${(A)=name=word}} expands to the number of elements in array "foo" after assignment. % unset foo; echo ${#${(A)=foo=a 'b c' d}}; typeset foo 3 foo=( a 'b c' d ) However, if "foo" ends up with just one element, the expression expands to the number of characters in that element. % unset foo; echo ${#${(A)foo=abc}}; typeset foo 3 foo=( abc ) % unset foo; echo ${#${(A)=foo=abc}}; typeset foo 3 foo=( abc ) % unset foo; echo ${#${(A)foo=a b c}}; typeset foo 5 foo=( 'a b c' ) % unset foo; echo ${#${(A)=foo='a b c'}}; typeset foo 5 foo=( 'a b c' ) The behavior is the same for ":=" and "::=". % echo $ZSH_PATCHLEVEL zsh-5.2-0-gc86c20a % setopt combiningchars extendedhistory incappendhistorytime interactive login monitor promptsubst shinstdin zle vq