From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11149 invoked by alias); 17 Nov 2016 05:04:14 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39961 Received: (qmail 11650 invoked from network); 17 Nov 2016 05:04:14 -0000 X-Qmail-Scanner-Diagnostics: from mx0a-001b2d01.pphosted.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(148.163.156.1):SA:0(-0.7/5.0):. Processed in 1.453842 secs); 17 Nov 2016 05:04:14 -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=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: hanpt@linux.vnet.ibm.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at linux.vnet.ibm.com does not designate permitted sender hosts) Date: Thu, 17 Nov 2016 10:33:25 +0800 From: Han Pingtian To: zsh-workers@zsh.org Subject: Re: Remind me why ${name+word} is the way it is? Mail-Followup-To: zsh-workers@zsh.org References: <161111203400.ZM31567@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161111203400.ZM31567@torch.brasslantern.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16111702-0024-0000-0000-00001509D0DE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006091; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00781721; UDB=6.00377127; IPR=6.00559233; BA=6.00004886; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013354; XFM=3.00000011; UTC=2016-11-17 02:33:34 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16111702-0025-0000-0000-00004632D978 Message-Id: <20161117023325.GA3324@localhost.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-16_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611170046 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.