From: William Ahern on
I'm searching for a glob that can expand to directories and symlinks to
directories (or optionally the linked directories). I'm doubtful this is
possible as a simple glob.

Example of zsh globbing for directories, but which fails on symlinks to
directories

/usr/local/*/{bin,sbin}(#q/)

From: William Ahern on
William Ahern <william(a)wilbur.25thandclement.com> wrote:
> I'm searching for a glob that can expand to directories and symlinks to
> directories (or optionally the linked directories). I'm doubtful this is
> possible as a simple glob.

> Example of zsh globbing for directories, but which fails on symlinks to
> directories

> /usr/local/*/{bin,sbin}(#q/)

D'oh

/usr/local/*/{bin,sbin}/(#q/)

The trailing slash was troublesome, but I was able to strip it with
parameter substitution elsewhere, so presumably I succeeded without creating
any additional processes.
From: Alan Curry on
In article <tlev17-1nf.ln1(a)wilbur.25thandClement.com>,
William Ahern <william(a)wilbur.25thandClement.com> wrote:
>I'm searching for a glob that can expand to directories and symlinks to
>directories (or optionally the linked directories). I'm doubtful this is
>possible as a simple glob.
>
>Example of zsh globbing for directories, but which fails on symlinks to
>directories
>
> /usr/local/*/{bin,sbin}(#q/)
>

zsh% echo *(-/)

The (/) qualifier matches directories only, but the (-) makes it follow
symlinks.

You might want to use (bin|sbin) to do the whole thing as a single glob
instead of {bin,sbin} which expands the braced group before globbing, then
does 2 separate globs.

From: johnb850 on
On Jan 12, 6:12 pm, pac...(a)kosh.dhis.org (Alan Curry) wrote:
> In article <tlev17-1nf....(a)wilbur.25thandClement.com>,
> William Ahern  <will...(a)wilbur.25thandClement.com> wrote:
>
> >I'm searching for a glob that can expand to directories and symlinks to
> >directories (or optionally the linked directories). I'm doubtful this is
> >possible as a simple glob.
>
> >Example of zsh globbing for directories, but which fails on symlinks to
> >directories
>
> >    /usr/local/*/{bin,sbin}(#q/)
>
> zsh% echo *(-/)
>
> The (/) qualifier matches directories only, but the (-) makes it follow
> symlinks.
>
> You might want to use (bin|sbin) to do the whole thing as a single glob
> instead of {bin,sbin} which expands the braced group before globbing, then
> does 2 separate globs.

Off the trail a little bit, but is find an option for you ?
Some thing like , type d , then use some stars in the name parm ? just
a thought,

find /usr/local -type d -name "*bin*"
From: Stephane CHAZELAS on
2010-01-14, 12:10(-08), johnb850(a)cox.net:
> On Jan 12, 6:12�pm, pac...(a)kosh.dhis.org (Alan Curry) wrote:
>> In article <tlev17-1nf....(a)wilbur.25thandClement.com>,
>> William Ahern �<will...(a)wilbur.25thandClement.com> wrote:
>>
>> >I'm searching for a glob that can expand to directories and symlinks to
>> >directories (or optionally the linked directories). I'm doubtful this is
>> >possible as a simple glob.
[...]
>> zsh% echo *(-/)
[...]
> Off the trail a little bit, but is find an option for you ?
> Some thing like , type d , then use some stars in the name parm ? just
> a thought,
>
> find /usr/local -type d -name "*bin*"

Unfortunately, that doesn't find symlinks to directories

find -L /usr/local -type d -name "*bin*"

would, but would also traverse symlinks when descending the
directories. There's no easy way to have one an not the other
without relying on an external command.

Though in the case above where we don't want to descend into
subdirectories, it would work:

find -L . ! -name . -prune -type d -print

But zsh's

print -rl -- *(D-/)

is simpler and gives you a sorted list of files.
(D is to include dot-dirs which find includes, add ! -name '.*'
to find to exclude dot-files).

--
St�phane