From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11066 invoked from network); 1 Dec 2003 12:03:10 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 1 Dec 2003 12:03:10 -0000 Received: (qmail 10056 invoked by alias); 1 Dec 2003 12:02:45 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6826 Received: (qmail 10044 invoked from network); 1 Dec 2003 12:02:44 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 1 Dec 2003 12:02:44 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 1 Dec 2003 12:2:43 -0000 Received: from EXCHANGE02.csr.com (unverified) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Mon, 1 Dec 2003 12:02:36 +0000 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 1 Dec 2003 12:04:00 +0000 To: Zsh Users Subject: Re: avoid file not found error with { .. } expansion In-reply-to: "Eric Smith"'s message of "Mon, 01 Dec 2003 12:17:35 +0100." <20031201111735.GA26591@fruitcom.com> Date: Mon, 01 Dec 2003 12:02:36 +0000 Message-ID: <9316.1070280156@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 01 Dec 2003 12:04:00.0880 (UTC) FILETIME=[34EBFF00:01C3B803] Eric Smith wrote: > What would be the correct invocation for this: > > $ xview {02..19}.*jpg > zsh: no matches found: 04.*jpg > > in order to avoid the error of files not being found. The main thing to remember is the mantra `brace expansion is not globbing'. When you use braces, all elements are generated regardless. Here, you get: xview 02.*jpg 03.*jpg 04.*jpg ... 19.*jpg before globbing kicks in. Are you simply trying to match a set of numbered files of which you're pretty sure some are there, but not all? Then the obvious thing to try is: xview <2-19>.*jpg There's no special handling for a leading zero here, but it will match one if present. If you want to be strict about the numeric format, then you need to keep the braces. Luckily, in this case you still have the `*', so the set of arguments generated are still globbing patterns. Thus you can get away with: xview {02..19}.*jpg(N) which turns on the NULL_GLOB option for all the patterns. Then any that don't match anything will simply be removed. What you *might* want in this case is for an error to be caused if and only if there were no matches to any pattern. With the form in angle brackets, that's what you get with your current option settings (since there is only one pattern). With the form in braces, you would need to `setopt csh_null_glob' to get this: setopt cshnullglob xview {02..19}.*jpg -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************