[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: @K transformation
From: |
Chet Ramey |
Subject: |
Re: @K transformation |
Date: |
Fri, 20 Aug 2021 18:06:23 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 |
On 8/19/21 6:37 AM, Léa Gris wrote:
#!/usr/bin/env bash
declare -A assoc=(
[P]=piano
[TB]='foldable table'
['CH AIR']=chair
)
options=("${assoc[@]@K}")
The best way to clone an associative array is:
declare -A options
eval options=\( "${assoc[@]@K}" \)
The quoting @K performs is eval-safe.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- feature request array expansion of keys values pairs and for k v loop, Léa Gris, 2021/08/18
- Re: feature request array expansion of keys values pairs and for k v loop, Koichi Murase, 2021/08/18
- @K transformation, Ilkka Virta, 2021/08/19
- Re: @K transformation, Koichi Murase, 2021/08/19
- Re: @K transformation, Léa Gris, 2021/08/19
- Re: @K transformation, Koichi Murase, 2021/08/19
- Re: @K transformation,
Chet Ramey <=
- Re: @K transformation, Léa Gris, 2021/08/20
- Re: @K transformation, Lawrence Velázquez, 2021/08/20
- Re: @K transformation, Greg Wooledge, 2021/08/20
- Re: @K transformation, Léa Gris, 2021/08/20
- use-cases promote thinking of limited application, L A Walsh, 2021/08/22
- Re: use-cases promote thinking of limited application, Koichi Murase, 2021/08/22
- Re: use-cases promote thinking of limited application, L A Walsh, 2021/08/23
- Re: use-cases promote thinking of limited application, Koichi Murase, 2021/08/23