From: DervishD <raul@pleyades.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh <zsh-workers@sunsite.dk>
Subject: Re: Getting rid of temporaries...
Date: Thu, 11 Sep 2003 11:36:30 +0200 [thread overview]
Message-ID: <20030911093630.GB50@DervishD> (raw)
In-Reply-To: <1030911010623.ZM7489@candle.brasslantern.com>
Hi Bart :)
* Bart Schaefer <schaefer@brasslantern.com> dixit:
> } Now the question: how can I do this without using the temporary
> } parameter 'array' and, if possible, without 'uniq'.
> If you have the array, it's easy to do without uniq.
Yes, with typeset -U, I just learned it a minute ago O:))
> The 'e' globbing flag gets you most of the way:
I tried, but didn't get any result.
> print -l *.??.jpg(e['REPLY=${REPLY%.??.jpg}'])
I didn't write anything so elaborated O:). Thanks for the line :)
But this doesn't do the 'uniqueness', so I still depend on the array
(typesetted with -U) or 'uniq'. No problem about that.
> Of course, that uses the magic temporary $REPLY variable, so it hasn't
> really eliminated temporaries.
No problem, because I want to get rid of the array so I could put
this in an alias instead of a function. Just for learning.
> } array=( /directory/*/* )
> This suggestion is on the right track, but it's not equivalent to Raul's
> original one, because your first assignment may match names that do not
> match *.<00-99>.jpg, which won't be modified by the second assignment.
Mine did, too. I'm sure that all filenames are of the form
name.digitdigit.jpg, so I carelessly matched all filenames.
> } though it might be a nice candidate for yet another parameter expansion
> } flag. :)
> You mean like ${(u)...}, which is in 4.1.1-dev-* ...
Oh, yes, I knew that I read it somewhere in this list. But I have
4.0.6 and that doesn't work, of course. Thanks for pointing :)
> typeset -U array
> array=( *.<00-99>.jpg(e['REPLY=${REPLY%.??.jpg}']) )
> print -l $array
Well, this is pretty compact, too :)) Thanks a lot :) I've
learned to use the (e) flag!
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
next prev parent reply other threads:[~2003-09-11 10:05 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
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 [this message]
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=20030911093630.GB50@DervishD \
--to=raul@pleyades.net \
--cc=schaefer@brasslantern.com \
--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).