* Negative Filename Generation
@ 2004-04-26 17:20 zzapper
2004-04-26 17:31 ` Peter Stephenson
0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2004-04-26 17:20 UTC (permalink / raw)
To: zsh-users
Hi
cygwin-zsh v4.2.0
I'm trying to follow some examples in the zsh doc:
eg the following : list all files beginning x NOT followed by a digit
>\ls x!([0-9])*
zsh: no matches found: x!([0-9])*
What I am I Donald Ducking Up here?
zzapper (vim, cygwin, wiki & zsh)
--
vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"
http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Negative Filename Generation 2004-04-26 17:20 Negative Filename Generation zzapper @ 2004-04-26 17:31 ` Peter Stephenson 2004-04-26 17:45 ` zzapper 0 siblings, 1 reply; 5+ messages in thread From: Peter Stephenson @ 2004-04-26 17:31 UTC (permalink / raw) To: zsh-users zzapper wrote: > Hi > > cygwin-zsh v4.2.0 > > I'm trying to follow some examples in the zsh doc: > > eg the following : list all files beginning x NOT followed by a digit > > >\ls x!([0-9])* > zsh: no matches found: x!([0-9])* > > > What I am I Donald Ducking Up here? Did you read the sentence a few lines above the definition of !(...) that starts If the KSH_GLOB option is set ... ? -- 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] 5+ messages in thread
* Re: Negative Filename Generation 2004-04-26 17:31 ` Peter Stephenson @ 2004-04-26 17:45 ` zzapper 2004-04-26 17:50 ` zzapper 2004-04-26 18:02 ` Peter Stephenson 0 siblings, 2 replies; 5+ messages in thread From: zzapper @ 2004-04-26 17:45 UTC (permalink / raw) To: zsh-users On Mon, 26 Apr 2004 18:31:00 +0100, wrote: >zzapper wrote: >> Hi >> >> cygwin-zsh v4.2.0 >> >> I'm trying to follow some examples in the zsh doc: >> >> eg the following : list all files beginning x NOT followed by a digit >> >> >\ls x!([0-9])* >> zsh: no matches found: x!([0-9])* >> >> >> What I am I Donald Ducking Up here? > >Did you read the sentence a few lines above the definition of !(...) >that starts > > If the KSH_GLOB option is set ... > >? unsetopt KSH_GLOB Didn't change anything for me zzapper (vim, cygwin, wiki & zsh) -- vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?" http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Negative Filename Generation 2004-04-26 17:45 ` zzapper @ 2004-04-26 17:50 ` zzapper 2004-04-26 18:02 ` Peter Stephenson 1 sibling, 0 replies; 5+ messages in thread From: zzapper @ 2004-04-26 17:50 UTC (permalink / raw) To: zsh-users Peter >setopt interactive login monitor nopromptcr shinstdin zle zzapper (vim, cygwin, wiki & zsh) -- vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?" http://www.vim.org/tips/tip.php?tip_id=305 Best of Vim Tips ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Negative Filename Generation 2004-04-26 17:45 ` zzapper 2004-04-26 17:50 ` zzapper @ 2004-04-26 18:02 ` Peter Stephenson 1 sibling, 0 replies; 5+ messages in thread From: Peter Stephenson @ 2004-04-26 18:02 UTC (permalink / raw) To: zsh-users zzapper wrote: > On Mon, 26 Apr 2004 18:31:00 +0100, wrote: > >> >\ls x!([0-9])* > >> zsh: no matches found: x!([0-9])* > > >Did you read the sentence a few lines above the definition of !(...) > >that starts > > > > If the KSH_GLOB option is set ... > > > >? > unsetopt KSH_GLOB > > Didn't change anything for me I was asking whether you'd turned it on, not off. Try reading the section (and the phrase I quoted) again. By the way, the equivalent zsh syntax is x(^[0-9])*. However, you will run up against a more subtle problem: !([0-9]) and (^[0-9]) don't mean `any character which isn't a single digit', they mean `any *pattern* which isn't a single digit'. So if the target filename is something like x123abc, x will match `x', !([0-9]) will match the empty string and * will match `123abc'. This is standard UNIX behaviour, although more confusing than usual here. You therefore need to tell it that the * shouldn't begin with digits either. Actually, the best way is (almost): ls x(^[0-9]*) which matches an x, followed by anything which isn't a string starting with a single digit. Unfortunately that looks like a glob qualifier to the matcher, so you need to tell it it isn't: ls x(^[0-9]*)(|) does what you want. The bit at the end just matches a null string, and since it has `|' in isn't a glob qualifier. There are other ways of doing it, including `setopt no_bare_glob_qual'. There's no simpler way for patterns in general, but this case (with a single character) obviously simplifies to: ls x[^0-9]* -- 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] 5+ messages in thread
end of thread, other threads:[~2004-04-26 18:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-04-26 17:20 Negative Filename Generation zzapper 2004-04-26 17:31 ` Peter Stephenson 2004-04-26 17:45 ` zzapper 2004-04-26 17:50 ` zzapper 2004-04-26 18:02 ` 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).