zsh-users
 help / color / mirror / code / Atom feed
From: Hannu Koivisto <azure@iki.fi>
To: Zsh Users' List <zsh-users@sunsite.dk>
Subject: Problem with glob qualifier e
Date: Mon, 05 Sep 2005 19:32:37 +0300	[thread overview]
Message-ID: <87u0gza316.fsf@trews52.bothi.fi> (raw)

Greetings,

The manual of zsh 4.2.1 says the following about the glob qualifier
e:

     filename.  In addition, the parameter reply may be set to an array
     or a string, which overrides the value of REPLY.  If set to an
     array, the latter is inserted into the command line word by word.

     For example, suppose a directory contains a single file
     `lonely'.  Then the expression `*(e:'reply=(${REPLY}{1,2})':)'
     will cause the words `lonely1 lonely2' to be inserted into the
     command line.

I can verify that the example works as described.  But I don't
understand how to extend that to more complex cases.

For instance, let's say that I would like to splice two command
line arguments after each file argument produced by a glob pattern.
If I have files sur and pur in the current directory, I would like
to say something along the lines of

echo (sur|pur)(e:'<something>':)

which, when expanded, should result to

echo pur -foo bar sur -foo bar

I expected

echo (sur|pur)(e:'reply=(${REPLY} -foo bar)':)

to do what I want but instead that results to

echo -foo -foo bar bar pur sur

I can't see how that follows from the quoted documentation.  In any
case, if my goal cannot be achieved with the glob qualifier e, is
there some other brief trick to modify the list of generated
filenames in such a way?

-- 
Hannu


             reply	other threads:[~2005-09-05 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-05 16:32 Hannu Koivisto [this message]
2005-09-05 17:22 ` Andrey Borzenkov
2005-09-05 19:05   ` Bart Schaefer
2005-09-06  2:51     ` Andrey Borzenkov
2005-09-06 13:58       ` Bart Schaefer
2005-09-05 18:39 ` 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=87u0gza316.fsf@trews52.bothi.fi \
    --to=azure@iki.fi \
    --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).