From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11223 invoked from network); 26 Apr 2004 18:03:06 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 26 Apr 2004 18:03:06 -0000 Received: (qmail 2922 invoked by alias); 26 Apr 2004 18:02:51 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7414 Received: (qmail 2892 invoked from network); 26 Apr 2004 18:02:51 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 26 Apr 2004 18:02:51 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 26 Apr 2004 18:2:51 -0000 Received: (qmail 10321 invoked from network); 26 Apr 2004 18:02:51 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 26 Apr 2004 18:02:48 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i3QI2Lv28118 for ; Mon, 26 Apr 2004 18:02:21 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Mon, 26 Apr 2004 19:01:53 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 26 Apr 2004 19:03:18 +0100 To: zsh-users@sunsite.dk Subject: Re: Negative Filename Generation In-reply-to: "zzapper"'s message of "Mon, 26 Apr 2004 18:45:24 BST." Date: Mon, 26 Apr 2004 19:02:21 +0100 Message-ID: <26188.1083002541@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 26 Apr 2004 18:03:18.0030 (UTC) FILETIME=[C0B54AE0:01C42BB8] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=BAYES_50 autolearn=no version=2.63 X-Spam-Hits: 0.0 zzapper wrote: > On Mon, 26 Apr 2004 18:31:00 +0100, wrote: > >> >\ls x!([0-9])* > >> zsh: no matches found: x!([0-9])* > > >Did you read the sentence a few lines above the definition of !(...) > >that starts > > > > If the KSH_GLOB option is set ... > > > >? > unsetopt KSH_GLOB > > Didn't change anything for me I was asking whether you'd turned it on, not off. Try reading the section (and the phrase I quoted) again. By the way, the equivalent zsh syntax is x(^[0-9])*. However, you will run up against a more subtle problem: !([0-9]) and (^[0-9]) don't mean `any character which isn't a single digit', they mean `any *pattern* which isn't a single digit'. So if the target filename is something like x123abc, x will match `x', !([0-9]) will match the empty string and * will match `123abc'. This is standard UNIX behaviour, although more confusing than usual here. You therefore need to tell it that the * shouldn't begin with digits either. Actually, the best way is (almost): ls x(^[0-9]*) which matches an x, followed by anything which isn't a string starting with a single digit. Unfortunately that looks like a glob qualifier to the matcher, so you need to tell it it isn't: ls x(^[0-9]*)(|) does what you want. The bit at the end just matches a null string, and since it has `|' in isn't a glob qualifier. There are other ways of doing it, including `setopt no_bare_glob_qual'. There's no simpler way for patterns in general, but this case (with a single character) obviously simplifies to: ls x[^0-9]* -- 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 **********************************************************************