From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13059 invoked from network); 4 Feb 2003 02:49:49 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 4 Feb 2003 02:49:49 -0000 Received: (qmail 16215 invoked by alias); 4 Feb 2003 02:49:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5867 Received: (qmail 16203 invoked from network); 4 Feb 2003 02:49:19 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 4 Feb 2003 02:49:19 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.46.181.248] by sunsite.dk (MessageWall 1.0.8) with SMTP; 4 Feb 2003 2:49:19 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h142nKM15244 for zsh-users@sunsite.dk; Mon, 3 Feb 2003 18:49:20 -0800 From: "Bart Schaefer" Message-Id: <1030204024920.ZM15243@candle.brasslantern.com> Date: Tue, 4 Feb 2003 02:49:20 +0000 In-Reply-To: <20030203212419.33206.qmail@web12307.mail.yahoo.com> Comments: In reply to Le Wang "check for existence without full globbing" (Feb 3, 4:24pm) References: <20030203212419.33206.qmail@web12307.mail.yahoo.com> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh users list Subject: Re: check for existence without full globbing MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 3, 4:24pm, Le Wang wrote: } } I wonder if there is a way to check if a glob pattern can be matched } without getting all files that can be globbed, i.e. a function that } return true after the first match is found. Out of curiosity, why? It can be done, but it requires forking a subshell, which may not make it any faster than just generating the list of files to begin with: if ( : *(Ne:exit 0:) ; exit 1 ) then print There are some files in this directory else print There are no files in this directory fi