Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: check for existence without full globbing
- X-seq: zsh-users 5868
- From: Le Wang <lewang@xxxxxxxxx>
- To: Zsh users list <zsh-users@xxxxxxxxxx>
- Subject: Re: check for existence without full globbing
- Date: Mon, 3 Feb 2003 22:29:05 -0500 (EST)
- In-reply-to: <1030204024920.ZM15243@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
--- Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author