zsh-users
 help / color / mirror / code / Atom feed
* *(@)/subdir expansion
@ 2004-06-07 22:44 Andy Isaacson
  2004-06-08  8:31 ` Thomas Köhler
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Isaacson @ 2004-06-07 22:44 UTC (permalink / raw)
  To: zsh-users

I'm suprised to find that this expansion doesn't work for me:

% ls *(@)/dry
zsh: no matches found: *(@)/dry
% ls -l
total 4
lrwxrwxrwx    1 adi      users           3 Jun  7 17:38 a -> bar/
lrwxrwxrwx    1 adi      users           3 Jun  7 17:38 b -> bar/
drwxr-xr-x    5 adi      users        4096 Jun  7 17:39 bar/
% ls -l bar/*
bar:
total 12
drwxr-xr-x    2 adi      users        4096 Jun  7 17:39 dry/
drwxr-xr-x    2 adi      users        4096 Jun  7 17:39 tiki/
drwxr-xr-x    2 adi      users        4096 Jun  7 17:38 wet/

bar/dry:
total 0
-rw-r--r--    1 adi      users           0 Jun  7 17:39 gin

bar/tiki:
total 0

bar/wet:
total 0

I'm using 4.0.7 on Fedora Core 1 and Debian Unstable.

Am I doing something wrong, is this expected behavior, or is it a bug?

-andy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: *(@)/subdir expansion
  2004-06-07 22:44 *(@)/subdir expansion Andy Isaacson
@ 2004-06-08  8:31 ` Thomas Köhler
  2004-06-12  5:43   ` Aaron Davies
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Köhler @ 2004-06-08  8:31 UTC (permalink / raw)
  To: Andy Isaacson; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

Andy Isaacson wrote:
> I'm suprised to find that this expansion doesn't work for me:
> 
> % ls *(@)/dry
> zsh: no matches found: *(@)/dry
[...]
> Am I doing something wrong, is this expected behavior, or is it a bug?

You expect glob qualifiers to work in the middle of a pattern
which they do not as explained in the zshexpn man page (see the
section about "Glob Qualifiers"):
   Patterns  used for filename generation may end in a list of
   qualifiers enclosed in parentheses.

Your pattern does not end in a list of qualifiers enclosed in
parentheses, because after the parentheses, there is some more
stuff. Seems you're out of luck here...

You might want to try something like
   for i in *(@) ; do ls $i/dry 2>/dev/null ; done

> -andy

Ciao,
Thomas

-- 
 Thomas Köhler       Email:       jean-luc@picard.franken.de
     <><             WWW:           http://jeanluc-picard.de
                     IRC:                           tkoehler
                     PGP public key available from Homepage!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: *(@)/subdir expansion
  2004-06-08  8:31 ` Thomas Köhler
@ 2004-06-12  5:43   ` Aaron Davies
  2004-06-14  9:41     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Davies @ 2004-06-12  5:43 UTC (permalink / raw)
  To: zsh-users

Thomas Köhler wrote:

> Andy Isaacson wrote:
>
>> I'm suprised to find that this expansion doesn't work for me:
>>
>> % ls *(@)/dry
>> zsh: no matches found: *(@)/dry
>>
>> Am I doing something wrong, is this expected behavior, or is it a bug?
>
> You might want to try something like
>
> for i in *(@) ; do ls $i/dry 2>/dev/null ; done

Really, the correct general solution to this is to fall back on the 
tool that zsh's extended glob attempts to make obsolete: GNU find. 
Despite its arcane and annoying syntax, it's still occasionally useful. 
In this case, you want to say

find *(@) -name dry -exec ls '{}' ';'
-- 
     __                      __
    /  )                    /  )
   /--/ __. .__  ______    /  / __. , __o  _  _
  /  (_(_/|_/ (_(_) / (_  (__/_(_/|_\/ <__</_/_)_


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: *(@)/subdir expansion
  2004-06-12  5:43   ` Aaron Davies
@ 2004-06-14  9:41     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2004-06-14  9:41 UTC (permalink / raw)
  To: zsh-users

Aaron Davies wrote:
> Really, the correct general solution to this is to fall back on the
> tool that zsh's extended glob attempts to make obsolete: GNU find.
> Despite its arcane and annoying syntax, it's still occasionally useful.
> 
> In this case, you want to say
> 
> find *(@) -name dry -exec ls '{}' ';'

It occurs to me that with the unambiguous (#q...) syntax for qualifiers
with the extendedglob option set, it would be possible to allow things
like

  ls *(#q@)/*

Currently the qualifiers there just get ignored, so there's no
ambiguity.

I haven't looked at the code and don't know if it would be useful enough
to justify the effort.  It's not particularly readable!

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-06-14  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-07 22:44 *(@)/subdir expansion Andy Isaacson
2004-06-08  8:31 ` Thomas Köhler
2004-06-12  5:43   ` Aaron Davies
2004-06-14  9:41     ` Peter Stephenson

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).