[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: zsh style associative array assignment bug
From: |
Oğuz |
Subject: |
Re: zsh style associative array assignment bug |
Date: |
Wed, 31 Mar 2021 11:48:26 +0300 |
On Tue, Mar 30, 2021 at 7:43 PM Eric Cook <llua@gmx.com> wrote:
> typeset -A tags=(); set --
> while IFS='|' read -ra ary; do
> set -- "$@" "${ary[@]}"
> done < <(
> exiftool -j *.flac |
> jq -r '.[]| {Artist, Track, Genre, Title}|to_entries[]| .key + "|" +
> .value'
> )
> eval 'tags=('"${*@Q}"\)
> typeset -p tags
> declare -A tags=([lofi]="Title" [Track]="Genre" [Artist]="AK420" ["A2 -
> Northern Lights"]="" )
>
Why so much trouble for such a simple operation?
$ declare -A tags
$ readarray -d '' -t ary < <(exiftool -j 05\ -\ Ted.flac |
jq -j '.[] | {Artist, Track, Genre, Title} | to_entries[] | [.key, .value,
""] | join("\u0000")')
$ eval 'tags=(' "${ary[@]@Q}" ')'
$ declare -p tags
declare -A tags=([Title]="Ted" [Genre]="Electronica/Dance" [Track]=""
[Artist]="Clark" )
- Re: zsh style associative array assignment bug, (continued)
- Re: zsh style associative array assignment bug, Chet Ramey, 2021/03/29
- Re: zsh style associative array assignment bug, Eric Cook, 2021/03/29
- Re: zsh style associative array assignment bug, Chet Ramey, 2021/03/30
- Re: zsh style associative array assignment bug, Eric Cook, 2021/03/30
- Re: zsh style associative array assignment bug, Greg Wooledge, 2021/03/30
- Re: zsh style associative array assignment bug, felix, 2021/03/31
- Re: zsh style associative array assignment bug, Greg Wooledge, 2021/03/31
- Re: zsh style associative array assignment bug, Chet Ramey, 2021/03/30
- Re: zsh style associative array assignment bug, Eric Cook, 2021/03/31
- Re: zsh style associative array assignment bug,
Oğuz <=
- Re: zsh style associative array assignment bug, Ilkka Virta, 2021/03/30