zsh-users
 help / color / mirror / code / Atom feed
* Ignore certain glob characters?
@ 2009-02-10 15:17 Benjamin R. Haskell
  2009-02-10 16:08 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin R. Haskell @ 2009-02-10 15:17 UTC (permalink / raw)
  To: Zsh Users

I'd like to be able to specify that I want no_nomatch behavior for certain 
meta-characters. With Windows commands, a common flag is '/?' (usually the 
semantic equivalent of '--help'), and I'm getting sick of typing '/\?':

$ runas /?
zsh: no matches found: /?

The other place this comes up is when pasting URLs into the terminal (both 
Windows/non):

$ wget http://example.com/probably?param=eters
zsh: no matches found: http://example.com/probably?param=eters

It'd be nice to selectively disable globbing in either of the following 
ways:

1. by choosing which metachars should not trigger NOMATCH
e.g. '?' and '[]' are common ones that trip me up only in Zsh.

2. by choosing prefixes that should trigger NO_NOMATCH
e.g. '/' or 'http://' for the above examples. Probably others. '-' on 
non-Windows.

Is there a way to do either of those? Or can someone suggest another 
workaround?

Best,
Ben


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

* Re: Ignore certain glob characters?
  2009-02-10 15:17 Ignore certain glob characters? Benjamin R. Haskell
@ 2009-02-10 16:08 ` Peter Stephenson
  2009-02-10 16:54   ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2009-02-10 16:08 UTC (permalink / raw)
  To: Zsh Users

"Benjamin R. Haskell" wrote:
> I'd like to be able to specify that I want no_nomatch behavior for certain
> meta-characters. With Windows commands, a common flag is '/?' (usually the
> semantic equivalent of '--help'), and I'm getting sick of typing '/\?':
> 
> $ runas /?
> zsh: no matches found: /?

Assuming you never want to use /? as a glob expression,

  alias -g '/?=/\?'

will fix that one.  This may well be a better answer than what you're
asking for, since otherwise commands like the one you show become
dependent on what's in the root directory.

> The other place this comes up is when pasting URLs into the terminal (both 
> Windows/non):
> 
> $ wget http://example.com/probably?param=eters
> zsh: no matches found: http://example.com/probably?param=eters

I would suspect you don't need globbing at all with wget, if you use it
for standard purposes, in which case the usual workaround,

  alias wget='noglob wget'

whould be OK.  I can't offhand think of a reason you'd need to wget a
globbing expression, but that's without diving into the manual.

I can't think of any answers that give you more general control.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: Ignore certain glob characters?
  2009-02-10 16:08 ` Peter Stephenson
@ 2009-02-10 16:54   ` Mikael Magnusson
  2009-02-10 17:46     ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2009-02-10 16:54 UTC (permalink / raw)
  To: Zsh Users

2009/2/10 Peter Stephenson <pws@csr.com>:
> "Benjamin R. Haskell" wrote:
>> I'd like to be able to specify that I want no_nomatch behavior for certain
>> meta-characters. With Windows commands, a common flag is '/?' (usually the
>> semantic equivalent of '--help'), and I'm getting sick of typing '/\?':
>>
>> $ runas /?
>> zsh: no matches found: /?
>
> Assuming you never want to use /? as a glob expression,
>
>  alias -g '/?=/\?'
>
> will fix that one.  This may well be a better answer than what you're
> asking for, since otherwise commands like the one you show become
> dependent on what's in the root directory.
>
>> The other place this comes up is when pasting URLs into the terminal (both
>> Windows/non):
>>
>> $ wget http://example.com/probably?param=eters
>> zsh: no matches found: http://example.com/probably?param=eters
>
> I would suspect you don't need globbing at all with wget, if you use it
> for standard purposes, in which case the usual workaround,
>
>  alias wget='noglob wget'
>
> whould be OK.  I can't offhand think of a reason you'd need to wget a
> globbing expression, but that's without diving into the manual.
>
> I can't think of any answers that give you more general control.

What about that magic-url-quote-insert or whatever it was called? (not
home so cant check manpage right now)

-- 
Mikael Magnusson


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

* Re: Ignore certain glob characters?
  2009-02-10 16:54   ` Mikael Magnusson
@ 2009-02-10 17:46     ` Mikael Magnusson
  0 siblings, 0 replies; 4+ messages in thread
From: Mikael Magnusson @ 2009-02-10 17:46 UTC (permalink / raw)
  To: Zsh Users

2009/2/10 Mikael Magnusson <mikachu@gmail.com>:
> 2009/2/10 Peter Stephenson <pws@csr.com>:
>> "Benjamin R. Haskell" wrote:
>>> I'd like to be able to specify that I want no_nomatch behavior for certain
>>> meta-characters. With Windows commands, a common flag is '/?' (usually the
>>> semantic equivalent of '--help'), and I'm getting sick of typing '/\?':
>>>
>>> $ runas /?
>>> zsh: no matches found: /?
>>
>> Assuming you never want to use /? as a glob expression,
>>
>>  alias -g '/?=/\?'
>>
>> will fix that one.  This may well be a better answer than what you're
>> asking for, since otherwise commands like the one you show become
>> dependent on what's in the root directory.
>>
>>> The other place this comes up is when pasting URLs into the terminal (both
>>> Windows/non):
>>>
>>> $ wget http://example.com/probably?param=eters
>>> zsh: no matches found: http://example.com/probably?param=eters
>>
>> I would suspect you don't need globbing at all with wget, if you use it
>> for standard purposes, in which case the usual workaround,
>>
>>  alias wget='noglob wget'
>>
>> whould be OK.  I can't offhand think of a reason you'd need to wget a
>> globbing expression, but that's without diving into the manual.
>>
>> I can't think of any answers that give you more general control.
>
> What about that magic-url-quote-insert or whatever it was called? (not
> home so cant check manpage right now)

Functions/Zle/url-quote-magic is the one I was thinking about.

-- 
Mikael Magnusson


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

end of thread, other threads:[~2009-02-10 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-10 15:17 Ignore certain glob characters? Benjamin R. Haskell
2009-02-10 16:08 ` Peter Stephenson
2009-02-10 16:54   ` Mikael Magnusson
2009-02-10 17:46     ` Mikael Magnusson

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