Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

eval "echo \"$a=( \${(qq)$a[@]} )\""



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