From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11823 invoked by alias); 12 Oct 2010 20:12:46 -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: 15446 Received: (qmail 620 invoked from network); 12 Oct 2010 20:12:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.47 as permitted sender) Date: Tue, 12 Oct 2010 21:12:24 +0100 From: Peter Stephenson To: Zsh Users Subject: Re: noglob + find Message-ID: <20101012211224.25ccb226@pws-pc> In-Reply-To: References: X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=3ENABmdyEd/Fm7fR7+mZIuMDn6+IErAeEhlfWBImZFk= c=1 sm=0 a=4YI7mmuYAqcA:10 a=kj9zAlcOel0A:10 a=YQfN4TnuAAAA:8 a=NLZqzBF-AAAA:8 a=GXbmWOtVkBgIGQhKa14A:9 a=Z-7yBgO976gGx77Mfou7Pl9eB48A:4 a=CjuIK1q_8ugA:10 a=bxnOgZBHIjQA:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Tue, 12 Oct 2010 15:09:18 -0400 (EDT) "Benjamin R. Haskell" wrote: > alias find='noglob find' > > $ find /tmp/tmp.* -name *.c -mtime -1 > find `/tmp/tmp.*': No such file or directory > > Is there a nice way to specify 'noglob'-like behavior for the arguments > after the first dashed argument? You have to do it other way round: expand the bits you did want globbing after all. alias find='noglob find' 'find'() { command find ${~1} "${(@)argv[2,-1]}"; } (working around all the usual exciting interactions between functions and aliases) which you can make smarter, to find the first argument with a -. 'find'() { integer i=${argv[(i)-*]} command find ${~argv[1,i-1]} "${(@)argv[i,-1]}" } is the first-pass version. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/