#!/bin/bash
arr1=( '$(rm -rf ~)' 'hello cruel world' )
arr2=( ' * suffix number 1 * ' 'suffix,with,commas' )
set -x
printf -v arr1_str '%q,' "${arr1[@]}"; arr1_str=${arr1_str%,}
printf -v arr2_str '%q,' "${arr2[@]}"; arr2_str=${arr2_str%,}
eval "printf '%s\n' {${arr1_str}}{${arr2_str}}"
IyEvYmluL2Jhc2gKYXJyMT0oICckKHJtIC1yZiB+KScgJ2hlbGxvIGNydWVsIHdvcmxkJyApCmFycjI9KCAnICogc3VmZml4IG51bWJlciAxICogJyAnc3VmZml4LHdpdGgsY29tbWFzJyApCgpzZXQgLXgKcHJpbnRmIC12IGFycjFfc3RyICclcSwnICIke2FycjFbQF19IjsgYXJyMV9zdHI9JHthcnIxX3N0ciUsfQpwcmludGYgLXYgYXJyMl9zdHIgJyVxLCcgIiR7YXJyMltAXX0iOyBhcnIyX3N0cj0ke2FycjJfc3RyJSx9CmV2YWwgInByaW50ZiAnJXNcbicgeyR7YXJyMV9zdHJ9fXske2FycjJfc3RyfX0i
$(rm -rf ~) * suffix number 1 *
$(rm -rf ~)suffix,with,commas
hello cruel world * suffix number 1 *
hello cruel worldsuffix,with,commas
+ printf -v arr1_str %q, '$(rm -rf ~)' 'hello cruel world'
+ arr1_str='\$\(rm\ -rf\ ~\),hello\ cruel\ world'
+ printf -v arr2_str %q, ' * suffix number 1 * ' suffix,with,commas
+ arr2_str='\ \*\ suffix\ number\ 1\ \*\ ,suffix\,with\,commas'
+ eval 'printf '\''%s\n'\'' {\$\(rm\ -rf\ ~\),hello\ cruel\ world}{\ \*\ suffix\ number\ 1\ \*\ ,suffix\,with\,commas}'
++ printf '%s\n' '$(rm -rf ~) * suffix number 1 * ' '$(rm -rf ~)suffix,with,commas' 'hello cruel world * suffix number 1 * ' 'hello cruel worldsuffix,with,commas'