Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: convert number
- X-seq: zsh-users 15070
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: convert number
- Date: Thu, 20 May 2010 07:51:09 -0700
- In-reply-to: <AANLkTikMDn2tqfIdv1-UE0ZtJrGY7cgMpUHREwor2a6_@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20100519191103.b712607f.tartifola@xxxxxxxxx> <AANLkTikMDn2tqfIdv1-UE0ZtJrGY7cgMpUHREwor2a6_@xxxxxxxxxxxxxx>
On Wed, May 19, 2010 at 11:39 AM, Christian Walther <cptsalek@xxxxxxxxx> wrote:
>
> if there is no mathematical formula for the "conversion table"
> available, I would put this table in a hash, e.g. something like:
>
> typeset -A convtable
> convtable[151]=2
> convtable[152]=2
>
> etc...
You can shortcut this:
typeset -A convtable
convtable=(151 2 152 2 153 2 158 4 159 3 160 2 171 4 172 1 173 4)
Note that you must have an even number of elements in the assignment
list, because they are taken as key value key value etc. The
assignment will fail otherwise.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author