From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: ignore globs that do not match
Date: Mon, 14 Jun 2004 01:31:55 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0406140121530.32342-100000@toltec.zanshin.com> (raw)
In-Reply-To: <20040614073704.GA18465@fruitcom.com>
On Mon, 14 Jun 2004, Eric Smith wrote:
> Thomas Köhler said:
> > mpg() {
> > local arg
> > local l
> > for arg ; do l="*$arg* $l" ; done
> > eval mpg321 $l
> > }
> >
>
> Nice!
Almost equivalent to, but more wordy than, my *${^@}* solution. The only
difference is that e.g.:
mpg 'd*n'
(note quotes) evals "mpg321 *d*n*" and therefore expands the middle "*"
as well. It wasn't clear you wanted those semantics.
> ("setopt cshnullglob" does not seem to work.)
That would be the way. Works when I try it, with either formulation of
the function.
> $ mpg dylan gibberish crespo
Are you sure there are no globbing characters in the gibberish? The
setopt will only apply inside the function, e.g. if you say
$ mpg foo*bar
then the shell first attempts to glob foo*bar and either gets "no match"
or calls the mpg function with the results as arguments.
Perhaps what you're after is something like:
mpg_glob() { mpg321 *${~^@}* }
alias mpg='noglob mpg_glob'
next prev parent reply other threads:[~2004-06-14 8:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-13 1:51 brace expansion in function Eric Smith
2004-06-13 4:31 ` Bart Schaefer
2004-06-13 12:53 ` Eric Smith
2004-06-13 16:04 ` Thomas Köhler
2004-06-14 7:37 ` ignore globs that do not match Eric Smith
2004-06-14 8:31 ` Bart Schaefer [this message]
2004-06-22 6:56 ` ignore globs that do not match -> prevent function from exiting Eric Smith
2004-06-22 7:17 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0406140121530.32342-100000@toltec.zanshin.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).