From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: globbing with interposition
Date: Tue, 19 Apr 2005 15:25:54 +0000 [thread overview]
Message-ID: <1050419152554.ZM31922@candle.brasslantern.com> (raw)
In-Reply-To: <20050419072115.GA15936@fruitcom.com>
In-Reply-To: <fb6be96e05041901223a87e20e@mail.gmail.com>
On Apr 19, 9:21am, Eric Smith wrote:
}
} mutt eric -a fotos* -s "all images attached" </dev/null
It would be really nice if this worked:
mutt eric fotos*(e:'reply=(-a $REPLY)':) -s "all images attached"
However, there's no way tell zsh NOT to sort the results of globbing.
I mention this so that I can propose a new key for the 'o' and 'O' glob
qualifiers, a key meaning "don't sort this glob at all."
For bizarre reasons I don't immediately understand, the following does
what you want, but probably isn't guaranteed to keep working in future
releases:
mutt eric fotos*(e:'reply=($REPLY -a)':od) -s "all images attached"
(and no, using Od instead of od doesn't change anything). That is, the
'od' qualifier prevents zsh from sorting the full list, but for some
reason zsh reverses the $reply array; e.g.:
touch frobnitz flobozz
print f*z(e:'reply=(1 2 $REPLY 3 4)':od)
will output something like
4 3 flobozz 2 1 4 3 frobnitz 2 1
This happens for 'oa', 'oc', and 'om' as well.
On Apr 19, 10:22am, J wrote:
} Subject: Re: globbing with interposition
}
} a=(fotos*) mutt eric '-a '${^a} -s "all images attached" </dev/null
That doesn't work because the order of assignment and expansion is not
what you expect. That is, the ${^a} is expanded at parse time, but
the assignment prefixes are handled at execute time. You'd have to do
a=(fotos*) eval 'mutt eric "-a "${^a} -s "all images attached" </dev/null'
but that suffers from the same problems as this:
} mutt eric '-a '${^$(print *)} -s "all images attached" </dev/null
That one fails if there are spaces in any of the file names, and on
top of that the space character after the -a is quoted, so mutt will
see '-a somefile' all as one string, not as '-a' and 'somefile'.
The only sure-fire way I can see to do it (without a loop similar to
Raúl's first suggestion) is like this:
a=()
: fotos*(e:'a+=(-a $REPLY)':)
mutt eric $a -s "all images attached" </dev/null
next prev parent reply other threads:[~2005-04-19 15:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-19 7:21 Eric Smith
2005-04-19 7:50 ` DervishD
2005-04-19 8:22 ` J
2005-04-19 8:35 ` DervishD
2005-04-19 15:25 ` Bart Schaefer [this message]
2005-04-19 15:36 ` J
2005-04-19 15:59 ` Peter Stephenson
2005-04-19 16:22 ` Bart Schaefer
2005-04-19 16:46 ` DervishD
2005-04-19 18:36 ` Oliver Kiddle
2005-04-21 10:45 ` globbing with interposition -> rocking Eric Smith - Fruitcom
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=1050419152554.ZM31922@candle.brasslantern.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).