Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Understanding why...
- X-seq: zsh-users 22798
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Clint Priest <cpriest@xxxxxxxxxxxxxxxx>
- Subject: Re: Understanding why...
- Date: Mon, 7 Aug 2017 17:36:22 -0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IQrF28a2rxVQEju/sRzuLH+IwAqyvLmqP56qJr2AsQI=; b=hLpwN0We2ySrwwHAjKNSKKFOJwQCa8++LL5iZ6/XvgWITkyKzpT9ksyZx1lmJFnkss YLLtpuEHMapst32CwjNQc7C4Mtr+hFyCaTi4HXiJt6QPV7ivoaTomSxHlgimdNTHXYGZ kzs5hCONCKBmXzXxqscWTGrwM7CI4Ud3lgL7DbeU8KB9B26ssexf7Fod4bo+zWNnL39v HY+iA/UA2rfuCvahPpKvqqPwpignPoJD+ktsavSVhxcaHRtmYGlf2/ZDwH7k7osvw0lG Z8tyf0IuG9F/N1xjFUP2qCtgJTea6vjzK+GWfuWglqqK93MNRGytvL3nRPMiNHng9yAq CywQ==
- In-reply-to: <20b0b8aa-6db5-9b61-961c-b9a7ba10f34d@zsh-users.rxv.me>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20b0b8aa-6db5-9b61-961c-b9a7ba10f34d@zsh-users.rxv.me>
On Mon, Aug 7, 2017 at 4:46 PM, Clint Priest <cpriest@xxxxxxxxxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author