Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
eval "echo \"$a=( \${(qq)$a[@]} )\""
- X-seq: zsh-users 21285
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: eval "echo \"$a=( \${(qq)$a[@]} )\""
- Date: Sun, 14 Feb 2016 18:16:41 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=UuYRK4H47dphX0M7xF2UTQfCFKYs8JU9i6A+dV38AYE=; b=0g7vCmuGrea0+fYITdE9fsLbkS14E2FBWwpLiLPx3mfifdDLsYKgfOb/WhLlLDyDX0 O2OidSeOHoAg+SW1ARhZDP7L3IgZsh5zGTtTL5SlcQDBifevBPJuK1DlY0MisqthZJti 8b1cq+plwV0CF3oeiCi7ZMaDI9kF0QkhTlDcH4XuWXcE44BoCvjknE/C3sAC/6Iya3P5 uuPW5NQALUQoTKMIE97W0U9EvmYnY6eADW2/27uv+S9D3UOmMRQTsSyKRIbjqVKUzA75 jk2FiPI2VdRtv57EYGW+ncSlF1hqgMIgmmuWsyaAvgMgYDWff+ssaNa/MNFtsGcJTCkG mfUw==
- 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
Hello,
say "a" holds array name "arr". Doing:
% a=arr; arr=( a b "c d" ); eval "echo \"$a=( \${(qq)$a[@]} )\""
yields:
arr=( 'a b c d' )
And it should be:
% k=arr; arr=( a b "c d" ); declline=`declare -p ${(q)k}`; echo
"$k=${declline#*=}"
arr=( a b 'c d' )
I would use the declare-output-catching way but no output is given for
"-hide-" (in (t)) variables. Maybe a workaround specifically to this?
How to accomplish what's needed? Printing array elements with correct
quoting, having indirect reference to the array – its name.
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author