From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28313 invoked by alias); 26 Feb 2017 00:58:41 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22501 Received: (qmail 22729 invoked from network); 26 Feb 2017 00:58:41 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f41.google.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(74.125.82.41):SA:0(1.0/5.0):. Processed in 1.36503 secs); 26 Feb 2017 00:58:41 -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=1.0 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLYTO, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: linux.tech.guy@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.82.41 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to; bh=tkkWH9VpSCpxrKKGZhgC0kfF/QPwdf4LQMwSS1yl5Fw=; b=sEKnbT5fq3ECm6zxUgDgdElrgSD/SfiuLWieuB4FR42DiqAP0OCePfXp9fb22egTDg FJNe3yATrNqik9rVWZNraif387/a/Ger44nE43FSvSvZX+yNs2iE6pnQ3eA7A4i6Wsfz QnwT7XAa9bch+LTN6A2wiaQSToRSchoJci0k/VF/iwSkkOukL17tllFmFZRhXb7DCtz+ xy39WwMkdtnFYPso5Q9bujCkmUb6ndHA4zhDUHg2L718w4QjEAc7bSCOAl/JQiKwjDRE y28MiItw8j1UZ/t1tCaGJi8EuYNszSk7YZr1TlmlY5fGpWCEfKE+pLXqdlD/zyVZtHoC aTwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to; bh=tkkWH9VpSCpxrKKGZhgC0kfF/QPwdf4LQMwSS1yl5Fw=; b=cnA4d8cVk/95gb5P2pWdeRmmxd5+ZD32UOB8xAfsyOVfCkDUPW6unvZiIRdNAyqmEl tghFOS+/M11yiScpJYa9yOCXLynUlPWG58doOSC+BmtEulKpyylagf+QglSCCiOVCE5U N+wNpvcgoDXy8NXezqSL/3jGYkSQISn82q9RUa6ZiUaSvMqSX2ugKISPbdHmYEbuI4jT mWFE/lrEHdFvKHum4XHy5B4AmbB9zXTfiB4MBL8rw31ho3jNcYEV4N0byHgKe6TBwIlP mqAYNSRV6nhobvS069SVFuBtyykO73pv2OPesXJ6zYVWRnHukeEE0V/wCowSd5Nlgx6c pVuA== X-Gm-Message-State: AMke39nJaivWzVB7nm2PbkhuyUAoodKD4w33bLha7OcPj399mBYLGRzkODII25JQ8U43a8T1uJsSLX6OhBC4gw== X-Received: by 10.28.100.132 with SMTP id y126mr8258640wmb.116.1488070712187; Sat, 25 Feb 2017 16:58:32 -0800 (PST) MIME-Version: 1.0 Reply-To: linuxtechguy@gmail.com In-Reply-To: <170225154140.ZM19138@torch.brasslantern.com> References: <170225141211.ZM20788@torch.brasslantern.com> <170225154140.ZM19138@torch.brasslantern.com> From: Jim Date: Sat, 25 Feb 2017 18:58:31 -0600 Message-ID: Subject: Re: A bug or improperly formatted script To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=001a114b2ecc33628e0549647624 --001a114b2ecc33628e0549647624 Content-Type: text/plain; charset=UTF-8 On Sat, Feb 25, 2017 at 5:41 PM, Bart Schaefer wrote: > On Feb 25, 4:53pm, Jim wrote: > } > } So in my original email the alternate example > } > } print $((${(z)${(fO)"$(dirs -v)"}[1][1]} + 1)) > } > } was this forcing it to an array or was it a fluke? > > It was a fluke. ${${$(print $'0\t~')[1]}[1]} == '0' whereas > ${${$(print $'0\t~')[-1]}[1]} == '~' and $(( ~ + 1 )) == -2 (the > tilde being interpreted as bitwise negation). > > Double-subscripting $var[1][1] yields the same byte whether $var is > a scalar or an array, whereas $var[-1][1] does not unless the scalar > is only a single character to begin with. > > You'd never have seen -2 if $HOME were not the only entry in the > stack. With $(dirs -lv) or with most other directories, the last char > of the directory name would have been intepreted as a variable name > and potentially produced even stranger results (though most like it > would be an unset variable and thus be treated as zero, hiding the > effect entirely). A directory name ending in digits would have made > things even stranger. > Still digesting, but I can say I learned my something new for today, so the day wasn't wasted. Looking forward to the patch you submitted. I had tried the (A) flag, just in case it might work, but it didn't. Wondered myself why it shouldn't apply in the case. Thanks for your help. Jim --001a114b2ecc33628e0549647624--