I have a problem loading an array from a variable containing
quotes and spaces, but interactively without a variable works fine. Here is the reproducible problem. I want the
array vararray to have the same element values as tarray,
but as you can see, when loading the same data from a
variable, it splits all the words for all the values into
separate elements of the array vararray.
Thanks for any help!
John
echo '"one two three four" "five six seven eight" "nine ten eleven"'
set -A tarray "one two three four" "five six seven eight" "nine ten eleven"
echo ${tarray[0]}
echo ${tarray[1]}
echo ${tarray[2]}
zarray='"one two three four" "five six seven eight" "nine ten eleven"'
echo $zarray
set -A vararray ${zarray}
echo ${vararray[0]}
echo ${vararray[1]}
echo ${vararray[2]}
quotes and spaces, but interactively without a variable works fine. Here is the reproducible problem. I want the
array vararray to have the same element values as tarray,
but as you can see, when loading the same data from a
variable, it splits all the words for all the values into
separate elements of the array vararray.
Thanks for any help!
John
echo '"one two three four" "five six seven eight" "nine ten eleven"'
set -A tarray "one two three four" "five six seven eight" "nine ten eleven"
echo ${tarray[0]}
echo ${tarray[1]}
echo ${tarray[2]}
zarray='"one two three four" "five six seven eight" "nine ten eleven"'
echo $zarray
set -A vararray ${zarray}
echo ${vararray[0]}
echo ${vararray[1]}
echo ${vararray[2]}