From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh users <zsh-users@sunsite.dk>
Subject: Re: Another expansion (substitution?) question
Date: Wed, 9 Jul 2003 04:42:44 +0000 [thread overview]
Message-ID: <1030709044244.ZM21535@candle.brasslantern.com> (raw)
In-Reply-To: <545d6gkyk8e.fsf@icd.teradyne.com>
On Jul 8, 1:57pm, Vin Shelton wrote:
} Subject: Another expansion (substitution?) question
}
} print -l ${(ou)${^$(all_dirs)}/$=~^*(N/:t)}
} zsh: bad pattern: emacs* o*(N
There are three problems here. One, you can't use an expansion that
does not have braces (in this case "$=~^*") nested inside an expansion
that does have braces. So you'd at least have to write (the following
is not a working substitution):
${(ou)${^$(all_dirs)}/${=~^*}(N/:t)}
However, problem two, globbing is not applied inside a nested expansion
so your "(N/:t)" qualifiers are useless; and problem three, a slash in
a brace-expansion is (as you found) a pattern substitution operator, as
is two slashes, which is why doubling it didn't work; and three slashes
in a row is probably being interpreted as substituting the empty string
for all occurrences of the empty string.
} x=( ${^$(all_dirs)}/$=~^*(N/:t) )
} print -l ${(ou)x}
The only way to reduce that to a one-liner is to use another subshell
like so:
print -l ${(ouf)"$(print -l ${^$(all_dirs)}/$=~^*(N/:t))"}
This is probably not worth the expense of the extra fork and I/O. Stick
with the two-liner using the temporary.
next prev parent reply other threads:[~2003-07-09 4:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-08 17:57 Vin Shelton
2003-07-09 4:42 ` Bart Schaefer [this message]
2003-07-09 4:48 ` Vin Shelton
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=1030709044244.ZM21535@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).