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 [email protected] http://cnswww.cns.cwru.edu/~chet/