zsh-users
 help / color / mirror / code / Atom feed
From: Le Wang <lewang@yahoo.com>
To: Zsh users list <zsh-users@sunsite.dk>
Subject: Re: check for existence without full globbing
Date: Mon, 3 Feb 2003 22:29:05 -0500 (EST)	[thread overview]
Message-ID: <20030204032905.15019.qmail@web12308.mail.yahoo.com> (raw)
In-Reply-To: <1030204024920.ZM15243@candle.brasslantern.com>

 --- Bart Schaefer <schaefer@brasslantern.com> 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


  reply	other threads:[~2003-02-04  3:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-03 21:24 Le Wang
2003-02-04  2:49 ` Bart Schaefer
2003-02-04  3:29   ` Le Wang [this message]
2003-02-04  5:16     ` Bart Schaefer
2003-02-04  9:38       ` John Buttery
2003-02-04 18:01         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030204032905.15019.qmail@web12308.mail.yahoo.com \
    --to=lewang@yahoo.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).