From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: zsh-workers@zsh.org
Subject: Re: Remind me why ${name+word} is the way it is?
Date: Thu, 17 Nov 2016 10:33:25 +0800 [thread overview]
Message-ID: <20161117023325.GA3324@localhost.localdomain> (raw)
In-Reply-To: <161111203400.ZM31567@torch.brasslantern.com>
On Fri, Nov 11, 2016 at 08:34:00PM -0800, Bart Schaefer wrote:
> Noodling with something else and ...
>
> torch% name='foo[bar]'
> torch% echo ${name}
> foo[bar]
> torch% echo ${name+foo[bar]}
When I was trying this I got this strange result of 'url-quote-magic':
% name=a;echo ${name:+foo[bar]}
zsh: no match
%
url-quote-magic:10: no match
%
url-quote-magic:10: no match
%
url-quote-magic:10: no match
%
url-quote-magic:10: no match
% =
url-quote-magic:10: no match
% ==
url-quote-magic:10: no match
% ===
url-quote-magic:10: no match
% ====
url-quote-magic:10: no match
% =====
space and = cause the warning "url-quote-magic:10: no match". This only
can be triggered by running "name=a;echo ${name:+foo[bar]}" first.
> zsh: no matches found: foo[bar]
> torch% print -l ${name+foo bar}
> foo bar
>
> So the "word" in ${name+word} and variants is not subject to splitting,
> but is subject to globbing, even though (w/o GLOB_SUBST SH_WORDSPLIT)
> ${name} is not subject to either of those.
>
> I know it's always been that way and I'm sure I knew why at some point.
next prev parent reply other threads:[~2016-11-17 5:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161112043435epcas1p1414be9386b843c435a1f1bc6cb242af1@epcas1p1.samsung.com>
2016-11-12 4:34 ` Bart Schaefer
2016-11-14 9:46 ` Peter Stephenson
2016-11-17 2:33 ` Han Pingtian [this message]
2016-11-17 5:34 ` Bart Schaefer
2016-11-23 1:26 ` Han Pingtian
2016-11-29 6:44 ` Spurious "no match" (Re: Remind me why ${name+word} is the way it is?) Bart Schaefer
2016-11-29 9:38 ` Peter Stephenson
2016-11-29 10:06 ` Peter Stephenson
2016-11-18 1:30 ` Remind me why ${name+word} is the way it is? Han Pingtian
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=20161117023325.GA3324@localhost.localdomain \
--to=hanpt@linux.vnet.ibm.com \
--cc=zsh-workers@zsh.org \
/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).