From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10668 invoked by alias); 8 Aug 2017 01:26:24 -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: 22799 Received: (qmail 13495 invoked by uid 1010); 8 Aug 2017 01:26:24 -0000 X-Qmail-Scanner-Diagnostics: from out1-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.25):SA:0(-0.7/5.0):. Processed in 2.231614 secs); 08 Aug 2017 01:26:24 -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.7 required=5.0 tests=HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: cpriest@zsh-users.rxv.me X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=YQQmyoGyPNKprClrCJ sR8Mh42X/l8YP0ilX70IDZwes=; b=bVwiR7FiKTa2lMb1nPmJRqSkwMHonCWcRk zUCos+GIqMZFS4HANEE46u2h2hoxdTg4u9wQ+bv9BVJ+NUMXBpUPguhbmQ3VtOiI yf7kSMXnFr8I5lutTKhp6XlePTC1CsEc9U/CygPN0UfjRHGxpJZStAJVjV0Cw1bz o7b0A9vHHebKzybUrJprv7RKz30QKNQcCpzwZ8fOwsODwM5UtWpfi9ILtUzGaJYR VlZ9BCM8i/PnU91rsiDYFcgtCXVcSVUO0feIEDfatq/toROeuqpRPvwx4EgJrNB+ dej4CMxmiUt2FvSrpjMFc7KwIzfaON4Pk15TCn8WORkmyKAGQNDA== X-ME-Sender: X-Sasl-enc: VuGImw99DWwdgBb3sdWUso43H64gl/TSXq6GjOC83lSw 1502155574 Subject: Re: Understanding why... To: Bart Schaefer Cc: Zsh Users References: <20b0b8aa-6db5-9b61-961c-b9a7ba10f34d@zsh-users.rxv.me> From: Clint Priest Message-ID: Date: Mon, 7 Aug 2017 20:26:12 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------44B5C2EFB610B4B1F2FBCBDF" Content-Language: en-US --------------44B5C2EFB610B4B1F2FBCBDF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Interesting, when you say by default, is that an option that can be changed? Thanks for that tidbit, any chance you know in the manual whereabouts it talks about this inner splitting and outer preservation? Also (and I had tried to do this), is it possible to break out the nested expansions into their separate parts to see what is going on (via trace)? I had tried that but it seemed that some zsh specific lines weren't showing (could have been because some of them where just variable sets, sans a typeset). Thanks Much! On 8/7/2017 7:36 PM, Bart Schaefer wrote: > On Mon, Aug 7, 2017 at 4:46 PM, Clint Priest wrote: >> I'll take an answer from someone here, but what I'd really like to find out >> is if there is *some sort of 'set -x' functionality that would give me >> verbose information *about what is going on. > No, there's no trace setting that would reveal the inner workings of > parameter expansion. Your best bet is to look at the documentation, > e.g., search for the string "Rules" in "man zshexpn". > >> typeset-A LSC=(${(@s/=/)${(@s/:/)${LS_COLORS%:}}}) >> >> What it needed was the two @ flags. I'd like to understand just what is >> going on in each step of the expansion that required those two flags. > The short answer is that a nested expansion by default joins arrays on > the first character of $IFS and yields a scalar result. The @ is > necessary to indicate that you want array-ness to be preserved. It's > actually the OUTER ${...} that enforces joining on the INNER > expression, so in the above you only need the leftmost @ so that s/:/ > isn't re-joined before s/=/ applies; but the second @ doesn't hurt. -- -Clint --------------44B5C2EFB610B4B1F2FBCBDF--