Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Redirection and Variables



* 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