zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: DervishD <raul@pleyades.net>, Zsh <zsh-workers@sunsite.dk>
Subject: Re: Getting rid of temporaries...
Date: Fri, 12 Sep 2003 11:27:57 +0200	[thread overview]
Message-ID: <22662.1063358877@gmcs3.local> (raw)
In-Reply-To: <20030911093927.GC50@DervishD>

DervishD wrote:

> > Can do the unique with the `e' globbing flag but not without
> > temporaries or eval.
> 
>     How can I do using eval? Assume that I don't have the (u) flag...

Wasn't as easy as I thought. Thought I could do something like:

guniq() { eval "[[ -z ${~REPLY:r:r}.<${~REPLY:r:e}->.jpg(N[2]) ]]" }
print -l *.??.jpg(e:guniq:)

But eval insists on quoting the third word in what it runs so it does
  [[ -z 'foo.<28->.jpg(N[2])' ]]
which is no use.

The guniq() function there isn't necessary, it just makes quoting
easier.

You can do this though:

guniq() { [[ -z "$2" ]] }
print -l *.??.jpg(e['eval "guniq ${REPLY:r:r}.<${REPLY:r:e}->.jpg"']:r:r)

This solution needs the separate function and is in effect using $@ as
a temporary array though.

Oliver


  reply	other threads:[~2003-09-12  9:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10 20:34 DervishD
2003-09-10 22:38 ` Danek Duvall
2003-09-11  1:06   ` Bart Schaefer
2003-09-11  1:46     ` Danek Duvall
2003-09-11  6:29     ` Oliver Kiddle
2003-09-11  8:56       ` Bart Schaefer
2003-09-11  9:40         ` DervishD
2003-09-11  9:43         ` DervishD
2003-09-11  9:39       ` DervishD
2003-09-12  9:27         ` Oliver Kiddle [this message]
2003-09-12 18:39           ` Bart Schaefer
2003-09-13 17:13             ` DervishD
2003-09-13 17:12           ` DervishD
2003-09-11  9:36     ` DervishD
2003-09-11  9:30   ` DervishD

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=22662.1063358877@gmcs3.local \
    --to=okiddle@yahoo.co.uk \
    --cc=raul@pleyades.net \
    --cc=zsh-workers@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).