From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1677 invoked by alias); 14 Jan 2017 06:51:44 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22372 Received: (qmail 2992 invoked from network); 14 Jan 2017 06:51:44 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.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(66.111.4.26):SA:0(-0.7/5.0):. Processed in 1.892801 secs); 14 Jan 2017 06:51:44 -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_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=H/l4PMWxjnPcniNfshqQvc8Lr1o=; b=gyYqHSzQxy/p7ILEobkkN B2LYIrLu6snMZviMML5pJKolx+TtlQEHlzRYAWZP4gMvfqw8xSkpCilmSPOPUvuA 1sSfYZ8cpm3g6SZiAsTm9ODsTrft2TVq9iNS79cHRuQ7upAZHeMu5tCrwdYOaxpu Ek2d+XPsBpznzL9iYBBO+o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=H/l4PMWxjnPcniNfshqQvc8Lr1o=; b=jPkyU2FQwvK8Klv9pPcG MbWb4hCsgR5VCzo4KB4UVvFteroXR7Ys753n/M2P69Dq5TekWdEJJ0K7XcTIMCup Tc3x91Ekk4T0GGA/Z+iDYA5/WaHk1Hsa+cPdS+QAgTIK/q/u1fEBKjty26ECZfzx Wn77Az77a1i22o8aGIgPgjk= X-ME-Sender: X-Sasl-enc: 0a+wzA29MJaOrLjpI52MI17LC0S8j/Hla9bDQA4J2kV3 1484376696 Date: Sat, 14 Jan 2017 06:48:07 +0000 From: Daniel Shahaf To: Ray Andrews Cc: zsh-users@zsh.org Subject: Re: whence question Message-ID: <20170114064807.GA31410@fujitsu.shahaf.local2> References: <652bcc3f-7365-2e52-d39c-8576278606bc@eastlink.ca> <7b890e89-d01b-ab5c-32bf-b75bfa8d945c__41234.9168131643$1484374276$gmane$org@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7b890e89-d01b-ab5c-32bf-b75bfa8d945c__41234.9168131643$1484374276$gmane$org@eastlink.ca> User-Agent: Mutt/1.5.23 (2014-03-12) Ray Andrews wrote on Fri, Jan 13, 2017 at 22:09:54 -0800: > On 13/01/17 09:11 PM, Bart Schaefer wrote: > >To expound a little on Daniel's answer, [...] Thanks, Bart. > I know that if a glob has no match it's passed verbatim so whence > sees what it's supposed to see, That's only true when 'setopt nonomatch' is in effect, which is not the default. By default, globs that have no match are considered errors. The NULL_GLOB option selects a third mode. See: % cd $(mktemp -d) % echo foo* zsh: no matches found: foo* % (setopt nullglob; echo foo*) | nl -ba % (setopt nonomatch; echo foo*) foo* % > [...] I can see that without 'noglob' the shell's zeal for expanding > globs is in more or less direct conflict with the intention of the 'm' > switch which supposes that whence will handle globing itself. I can > also see that that might not be fixable even in theory for reasons of > consistency, Right: while there are several ways to make a shell builtin command see globs in arguments, the default behaviour of existing (released) commands can't be changed for compatibility reasons. Also, the existing design has merits: *every* external and builtin command parses "words with globbing metacharacters" the same way. «echo *foo» and «whence *foo» and «bar *foo» are all subject to the same rules. The rules are consistent for everybody. That's a feature. The most ${adjective} exception to the rule is the '[[' reserved word; but note that its older variant, '[', abides by the rule. Cheers, Daniel [sorry for that botched interpolation in the last paragraph; I had nonomatch enabled in my compose window's parameter interpolation code while I was writing this email. ;-)]