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

Re: Redirection and Variables



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