zsh-workers
 help / color / mirror / code / Atom feed
* Bug in filename expansion
@ 1996-06-20 15:29 Ray Van_Tassle
  1996-06-20 20:48 ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Ray Van_Tassle @ 1996-06-20 15:29 UTC (permalink / raw)
  To: zsh-workers

I do this:
>touch zzayy                                                             ~/temp
>touch zzbyy                                                             ~/temp
>touch zzxyy                                                             ~/temp
>ls zz*                                                                  ~/temp
zzayy  zzbyy  zzxyy

>ls zz(a|b)yy                                                            ~/temp
zzayy  zzbyy

>ls zz^(a|b)yy                                                           ~/temp
zsh: no match
 
Seems wrong.  According to the man pages, the 2nd command should give me
the files that start with "zz", then have either "a" or "b", and end with "yy".
OK.
But the 3rd command should give me the files that start with "zz", then have
a character OTHER than "a" or "b", and end with "yy".
It should give me "zzxyy", but it doesn't.
 
This is with zsh-2.6-beta20
 
Thanks,
Ray Van Tassle
rayvt@comm.mot.com



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

* Re: Bug in filename expansion
  1996-06-20 15:29 Bug in filename expansion Ray Van_Tassle
@ 1996-06-20 20:48 ` Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-06-20 20:48 UTC (permalink / raw)
  To: Ray Van_Tassle; +Cc: zsh-workers

> >ls zz*
> zzayy  zzbyy  zzxyy
> 
> >ls zz(a|b)yy
> zzayy  zzbyy
> 
> >ls zz^(a|b)yy
> zsh: no match
>  
> Seems wrong.
[...]
> But the 3rd command should give me the files that start with "zz", then have
> a character OTHER than "a" or "b", and end with "yy".
> It should give me "zzxyy", but it doesn't.

No, it isn't wrong.  ^pattern matches if pattern does not match.  You should
use groupping.

zz^(a|b)yy is the same as zz^((a|b)yy) and zz(^(a|b))yy is what you want.

Zoltan



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

* Re: Bug in filename expansion
  1996-06-21 15:26 Ray_Van_Tassle-CRV004
@ 1996-06-21 16:54 ` Mark Borges
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Borges @ 1996-06-21 16:54 UTC (permalink / raw)
  To: Ray_Van_Tassle-CRV004; +Cc: zsh-workers

>> On 21 Jun 96 10:26:27 -0500,
>> Ray Van Tassle-CRV004(RVT) wrote:
>> use groupping.
>> 
>> zz^(a|b)yy is the same as zz^((a|b)yy) and zz(^(a|b))yy is what you want.
>> 
RVT> No, that doesn't work either.  Also, if my 1st attempt ("zz^(a|b)yy") is
RVT> incorrect, this is a surprise, and it should probably be mentioned in the
RVT> documentation.

This is one of those "only works with extendedglob set"
things. Perhaps the manual should be clearer, if it isn't (I haven't
had time to check carefully yet).

  $ ~/bin/sunos-5.5/zsh-2.6b21 -f
  % touch zz{a,b,x}yy
  % ls
  zzayy  zzbyy  zzxyy
  % echo zz(a|b)yy
  zzayy zzbyy
  % echo zz^(a|b)yy
  zsh: no matches found: zz^(a|b)yy
  % setopt extendedglob
  % echo zz^(a|b)yy
  zzxyy
  % echo zz^((a|b))yy
  zzxyy
  % echo $ZSH_VERSION
  2.6-beta21
  %

-- 
  -mb-



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

* RE: Bug in filename expansion
@ 1996-06-21 15:26 Ray_Van_Tassle-CRV004
  1996-06-21 16:54 ` Mark Borges
  0 siblings, 1 reply; 4+ messages in thread
From: Ray_Van_Tassle-CRV004 @ 1996-06-21 15:26 UTC (permalink / raw)
  To: Receipt Notification Requested, Receipt Notification Requested
  Cc: Receipt Notification Requested


[[ example deleted ]]
> No, it isn't wrong.  ^pattern matches if pattern does not match.  You 
should
> use groupping.
> 
> zz^(a|b)yy is the same as zz^((a|b)yy) and zz(^(a|b))yy is what you want.
> 
> Zoltan
>
No, that doesn't work either.  Also, if my 1st attempt ("zz^(a|b)yy") is
incorrect, this is a surprise, and it should probably be mentioned in the
documentation. Or maybe the precedence of "^" changed ?
If there isn't a bug here (and I think there is), then we need some
further examples of "how to do it".

Also.... how can I do a parenthisised group at the *end* of a pattern?  It 
thinks that this is a "list of qualifiers".


Here's my trial script & output:
 
setopt verbose
touch zzayy
touch zzbyy
touch zzxyy
ls zz*
zzayy
zzbyy
zzxyy
#next works--shows a & b
ls zz(a|b)yy
zzayy
zzbyy
#next doesn't work--should show x
ls zz^(a|b)yy
./try: no match [9]
# zoltan says the above means the same as next
ls zz(^(a|b)yy)
./try: no match [11]
# zoltan says this will show x. but it doesn't
ls zz(^(a|b))yy
./try: no match [13]
unsetopt verbose



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

end of thread, other threads:[~1996-06-21 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-20 15:29 Bug in filename expansion Ray Van_Tassle
1996-06-20 20:48 ` Zoltan Hidvegi
1996-06-21 15:26 Ray_Van_Tassle-CRV004
1996-06-21 16:54 ` Mark Borges

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