From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13479 invoked from network); 4 Feb 2003 03:29:30 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 4 Feb 2003 03:29:30 -0000 Received: (qmail 23919 invoked by alias); 4 Feb 2003 03:29:04 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5868 Received: (qmail 23912 invoked from network); 4 Feb 2003 03:29:04 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 4 Feb 2003 03:29:04 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [216.136.173.106] by sunsite.dk (MessageWall 1.0.8) with SMTP; 4 Feb 2003 3:29:4 -0000 Message-ID: <20030204032905.15019.qmail@web12308.mail.yahoo.com> Received: from [24.192.182.203] by web12308.mail.yahoo.com via HTTP; Mon, 03 Feb 2003 22:29:05 EST Date: Mon, 3 Feb 2003 22:29:05 -0500 (EST) From: Le Wang Subject: Re: check for existence without full globbing To: Zsh users list In-Reply-To: <1030204024920.ZM15243@candle.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii --- Bart Schaefer wrote: > 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? I need to get a list of directories that have .java files in them. Here is the snipplet: for i ( $sourcePath ) { for j ( $i/**/*(-/) ) { setopt localoptions setopt nullglob unsetopt globsubst tempArr=( $j/*.java ) if (( $#tempArr >= 1 )); then temp=${j#$i/} temp=${temp//\\//.} packages=( $packages $temp ) fi } } It was taking quite a while to glob through all the .java files. But it was even slower to use the subshell method (like you suspected). Ohh well. -- Le ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca