From: Deliverable Mail <deliverable@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>, zsh-users@sunsite.dk
Subject: Re: add-path, rm-path
Date: Wed, 28 Sep 2005 20:07:41 -0700 [thread overview]
Message-ID: <7c737f30050928200751eae4b8@mail.gmail.com> (raw)
In-Reply-To: <1050929030313.ZM25022@candle.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]
I must say I'm impressed even more with zsh. So far it has absolutely
everything imaginable! Thanks for all the fish. :)
Cheers,
Alexy
On 9/28/05, Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Sep 28, 3:16pm, Deliverable Mail wrote:
> }
> } Many people have python-esque scripts which add a path to a PATH-like
> } variable only if it's not there already, or remove it from there
> completely.
> } I wonder whether zsh has it embedded?
>
> Zsh has three components that together accomplish this. The first is
> automatic linkage between arrays and colon-separated scalars, in this
> case the array "path" and the scalar "PATH".
>
> The second is "typeset -U" for creating self-uniquifying arrays.
>
> The third is ${array:#pattern} for removing elements matching a pattern
> from an array.
>
> The only time you need a function is when you want to control the order
> in which the single remaining instance of a duplicated element appears
> in the array, after de-duping. The "typeset -U" behavior is to keep
> the one with the lowest array index, even if that means inserting a new
> element and deleting an existing equivalent one.
>
[-- Attachment #2: Type: text/html, Size: 1591 bytes --]
prev parent reply other threads:[~2005-09-29 3:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-28 22:16 Deliverable Mail
2005-09-29 3:03 ` Bart Schaefer
2005-09-29 3:07 ` Deliverable Mail [this message]
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=7c737f30050928200751eae4b8@mail.gmail.com \
--to=deliverable@gmail.com \
--cc=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).