zsh-users
 help / color / mirror / code / Atom feed
* Glob'ing for a pattern that DOESN'T match...
@ 1998-03-16 21:11 Eddy J. Gurney
  1998-03-17  1:43 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Eddy J. Gurney @ 1998-03-16 21:11 UTC (permalink / raw)
  To: zsh-users

I'm trying to write a `compctl' for `rm' so that `rm' will never complete
on various source files (.c, .h, .cc, .c++, etc.) and am having no luck
in getting it to work.

One of the biggest problems is that ZSHEXPN man page says that:

    ^x   matches anything except the pattern x.

but for the life of me I can't get it to work, even from the shell!

Any ideas on what I might be doing wrong?

Thanks,
Eddy

P.S. The version of zsh currently installed in 3.0.2, I noticed 3.0.5 is
     available but haven't compiled it yet.

-- 
Eddy J. Gurney


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

* Re: Glob'ing for a pattern that DOESN'T match...
  1998-03-16 21:11 Glob'ing for a pattern that DOESN'T match Eddy J. Gurney
@ 1998-03-17  1:43 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1998-03-17  1:43 UTC (permalink / raw)
  To: Eddy J. Gurney, zsh-users

On Mar 16,  4:11pm, Eddy J. Gurney wrote:
} Subject: Glob'ing for a pattern that DOESN'T match...
}
} One of the biggest problems is that ZSHEXPN man page says that:
} 
}     ^x   matches anything except the pattern x.
} 
} Any ideas on what I might be doing wrong?

Have you tried `setopt extendedglob` ?

} I'm trying to write a `compctl' for `rm' so that `rm' will never complete
} on various source files (.c, .h, .cc, .c++, etc.) and am having no luck
} in getting it to work.

This should get you started:

setopt extendedglob
compctl -g '^*.(c|h|cc|c++)' rm

You might think that ^*.{c,h,cc,c++} should work, but brace expansion is
not part of globbing (something I find extremely counter-intuitive); so
that's actually shorthand for the four patterns ^*.c ^*.h ^*.cc ^*.c++,
each of which includes everything excluded by the others (and you end up
right back where you started).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1998-03-17  2:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-16 21:11 Glob'ing for a pattern that DOESN'T match Eddy J. Gurney
1998-03-17  1:43 ` Bart Schaefer

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