$ str="a'\"b"
$ declare -p str
declare -- str="a'\"b" # see " was escaped, possibly other chars will too
$ astr=("$str" "c")
$ declare -p astr
declare -ax astr='([0]="a'\''\"b" [1]="c")'
so, is there some way to do something like declare -p astr[0]
and retrieve something like this: declare -- astr[0]="a'\"b"
?
I could use sed
or something else, but I would like to know if bash allow accessing astr[n] thru declare -p
in some way I couldn't guess yet?