Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirection and Variables
- X-seq: zsh-users 8087
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Nikolai Weibull <zsh-users-list@xxxxxxxxxxxxx>
- Subject: Re: Redirection and Variables
- Date: Thu, 21 Oct 2004 15:57:34 +0200
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20041019120220.GA9258@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041019120220.GA9258@xxxxxxxxxxxxxxxxxx>
Nikolai Weibull wrote:
>
> 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]"
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author