[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Core dump
From: |
Chet Ramey |
Subject: |
Re: Core dump |
Date: |
Thu, 27 Apr 2017 17:57:03 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 |
On 4/27/17 3:56 PM, Vladimir Marek wrote:
> array_to_key() {
> # Converts 1 2 3 -> 1,2,3, (comma at the end)
> printf '%d,' "$@"
> }
>
> multi_store() {
> local array_name="$1"; shift
> local value="$1"; shift
> if unset -v "$array_name"; then
> declare -A $array_name
> declare -- $array_name[$(array_to_key "$@")]="$value"
> fi
> }
>
> multi_store CHESS_3D queen 2 2 5
Bash version? This was fixed before bash-4.3 was released.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- Core dump, Vladimir Marek, 2017/04/27
- Re: Core dump,
Chet Ramey <=