zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: linuxtechguy@gmail.com
Cc: zsh <zsh-users@zsh.org>
Subject: Re: glob inside nested parameter expansion returns glob string
Date: Thu, 21 Apr 2022 20:51:15 +0200	[thread overview]
Message-ID: <CAHYJk3SMjNwRc9zkL+=-F0zPgpzMks1EFBUwHDkUL5AsP_4GqQ@mail.gmail.com> (raw)
In-Reply-To: <CA+rB6G+ujzDmSpyO8PE2SDTc_5jQeEPoLQbO4pqZ+0qeBg_Knw@mail.gmail.com>

On 4/21/22, Jim <linux.tech.guy@gmail.com> wrote:
> Hi,
>
> The following two statements produce the expected results:
>
> % A=(${:-.z*(.N)})
> % A=(${A:#*(comp|hist)*})
>
> When trying to nest the two, the result is the glob statement:
>
> A=(${${:-.z*(.N)}:#*(comp|hist)*})
>
> Trying to understand why this is the case.  Could someone explain why this
> happens?
> Is there a way to nest the two?

There is a certain order that parameter expansions and globs happen
relative to eachother, nesting param expansions does not change the
order of processing. Eg, there is not really any way you can process
.z* before the outer :# happens, which will operate on the
pre-expanded string in your final combined statement. In short, no(t
as far as I know).

-- 
Mikael Magnusson


  reply	other threads:[~2022-04-21 18:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 17:24 Jim
2022-04-21 18:51 ` Mikael Magnusson [this message]
2022-04-21 19:15   ` Bart Schaefer
2022-04-21 20:37     ` Jim
2022-04-21 21:00       ` Jim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHYJk3SMjNwRc9zkL+=-F0zPgpzMks1EFBUwHDkUL5AsP_4GqQ@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=linuxtechguy@gmail.com \
    --cc=zsh-users@zsh.org \
    --subject='Re: glob inside nested parameter expansion returns glob string' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).