Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirection and Variables
- X-seq: zsh-users 8088
- From: Nikolai Weibull <zsh-users-list@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Redirection and Variables
- Date: Thu, 21 Oct 2004 16:41:30 +0200
- In-reply-to: <25461.1098367054@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041019120220.GA9258@xxxxxxxxxxxxxxxxxx> <25461.1098367054@xxxxxxxxxxxxxxxxxxxxx>
* Oliver Kiddle <okiddle@xxxxxxxxxxx> [Oct 21, 2004 16:00]:
> > Is this the simplest way to do the following?
> >
> > local -A http_programs https_programs mailto_programs ftp_programs
> >
> > http_programs=(xw "/usr/bin/firefox -remote 'openURL(%s, new-tab)'"
> > xt "/usr/bin/elinks '%s'")
> > mailto_programs=(xt "/usr/bin/mutt '%s'")
> You could use one associative array, including more than one piece of
> information in the key. That avoids the need for the (P) flag:
> programs=(
> http_xw "/usr/bin/firefox -remote 'openURL(%s, new-tab)'"
> mailto_xt "/usr/bin/mutt '%s'"
> )
> > echo "${(P)$(echo ${1}_programs\[xw\])}"
> That could then be:
> echo "$programs[$1_xw]"
How very true. It seems that I split the problem along the wrong axis.
It's kind of hard thinking without "hashes-of-hashes",
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author