From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21136 invoked by alias); 25 Feb 2017 23:42:02 -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: 22500 Received: (qmail 13525 invoked from network); 25 Feb 2017 23:42:02 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net 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(205.235.26.22):SA:0(0.0/5.0):. Processed in 1.166606 secs); 25 Feb 2017 23:42:02 -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=HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=di5J=2G=brasslantern.com=schaefer@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at bounces.park01.gkg.net does not designate permitted sender hosts) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=QLbRqkyFyxD3m/hn6h7DUqnX8c0afbQ9dC8vOEw1Gl4=; b=py2RWsm+IGMs02o4NQOj3eKdTp+lKbCVzQb2WfPNq3B8YqfLs5eKnhbR1xvnygHILg ZjgWPyAxblpitYLoc2GS723mYVWSXKvbct0xypJMvOxk/ACpa4EyDrNm5zic64DyzlR+ mCnjZgiUM4R7EL1HLaome8RIpNj994iXTTBIZTLpkYeHMGPmvnNwZfUHMYybcWcKJfDF gYoU49JDNbzDbW3c/fQnCOUCV/EGKaFHmvCa1boG25rcVU5o2enIP7bY4XW+EGC6K+S1 T002ng5TYd4KXbU0DKh4yQjNAoeT3dGeyT+AVFLN75HtMM9Hp4C7l0INl5xMhl8XqVMF k9Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=QLbRqkyFyxD3m/hn6h7DUqnX8c0afbQ9dC8vOEw1Gl4=; b=jHyF0gV9dSCDbxm2wr3oktWynwnD2nNttdDvZJ9pFv64f+JtzC4lhJC33Tg70oPz4g 3BJC6w4XMoJs4IPSHRY7l7ww3luVXWRAzd5PvKP77b6fmT1pLpN/q2m16fVPKWyZdJ5K bTUPmmF3prwvg4ST5MZwwEDGuJBiHEd+HbGHtC8Cpg8AAFpudEE6w5h3lPD3ikW+w5wN g0JgCRnsi1GdLJZmqBmWxa9Aj+nunEIJKfsb3DamrFStpx0yFoBPgwogWjUJn5izK6Pf KL85Ax0nNqayrXClmRCMqVEzufPncaFzxY+KRgdjeQWvmQcg1JQPKgku16rnGRFfNaML DHAg== X-Gm-Message-State: AMke39nUWthlp2aiYj7WeA5A3mOInrHZdoYqreX27SFjORlouRpMYC0cqPoP/5QyVrB8Jg== X-Received: by 10.31.95.149 with SMTP id t143mr3598326vkb.49.1488066091575; Sat, 25 Feb 2017 15:41:31 -0800 (PST) From: Bart Schaefer Message-Id: <170225154140.ZM19138@torch.brasslantern.com> Date: Sat, 25 Feb 2017 15:41:40 -0800 In-Reply-To: Comments: In reply to Jim "Re: A bug or improperly formatted script" (Feb 25, 4:53pm) References: <170225141211.ZM20788@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: linuxtechguy@gmail.com, zsh-users@zsh.org Subject: Re: A bug or improperly formatted script MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.